Skip to content

feat: add PHP-compatible PCNTL support - #733

Draft
nahime0 wants to merge 21 commits into
mainfrom
feat/pcntl
Draft

feat: add PHP-compatible PCNTL support#733
nahime0 wants to merge 21 commits into
mainfrom
feat/pcntl

Conversation

@nahime0

@nahime0 nahime0 commented Aug 19, 2026

Copy link
Copy Markdown
Member

Summary

  • add PCNTL support across the builtin contract, EIR lowering, target-aware code generation, runtime helpers, and the optional elephc-pcntl bridge
  • implement process control with pcntl_fork(), wait/waitpid status handling, priorities, process groups and sessions, daemonization, and exec
  • implement PHP-compatible signal registration, delivery, dispatch, masking, alarms, async signals, signal information, and synchronous signal waiting
  • provide PCNTL support in Magician, including callable handlers, by-reference outputs, restart-syscall behavior, and exception-safe dispatch
  • preserve PHP semantics for forked signal queues, failed waits, dispatch snapshots, reentrancy, exceptions, invalid signals, OS warnings, and Fiber switching during handlers
  • support macOS AArch64, Linux AArch64, and Linux x86_64 through target-specific constants and runtime behavior
  • add focused bridge modules, end-to-end and error regressions, a PCNTL user guide, --with-pcntl documentation, generated compatibility data, and the completed implementation checklist

Testing

  • cargo build
  • cargo test -p elephc-pcntl --lib
  • cargo test -p elephc-magician omitted_restart_syscalls_is_false_only_for_sigalrm
  • cargo test --test codegen_tests pcntl — 34 passed on macOS AArch64
  • ./scripts/test-linux-x86_64.sh pcntl — 35 PCNTL codegen tests and 17 PCNTL error tests passed
  • ./scripts/test-linux-arm64.sh pcntl — 35 PCNTL codegen tests and 17 PCNTL error tests passed; the wrapper subsequently exited with code 101 because Cargo attempted to execute a missing, zero-match Magician test binary
  • cargo build --example gen_builtins
  • python3 scripts/docs/extract_builtins.py --render --force
  • python3 scripts/docs/test_gen_php_comparison.py
  • python3 scripts/docs/gen_php_comparison.py
  • python3 scripts/docs/audit_builtins.py
  • python3 scripts/docs/elephc_builtins/validate_site_compat.py
  • python3 scripts/audit_builtin_eir_boundary.py --enforce-target-architecture
  • assembly comment checks for the touched emitters
  • cargo fmt --all -- --check
  • git diff --check

@github-actions github-actions Bot added area:builtins Touches PHP builtin declarations or emitters. area:magician Touches eval, include execution, or elephc-magician. area:runtime Touches runtime helpers, GC, ownership, or bridge runtimes. scope:multi-area Touches more compiler areas than the automatic area-label cap. size:xl Very large pull request that needs deliberate review planning. type:feature Introduces new user-visible behavior or capabilities. labels Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:builtins Touches PHP builtin declarations or emitters. area:magician Touches eval, include execution, or elephc-magician. area:runtime Touches runtime helpers, GC, ownership, or bridge runtimes. scope:multi-area Touches more compiler areas than the automatic area-label cap. size:xl Very large pull request that needs deliberate review planning. type:feature Introduces new user-visible behavior or capabilities.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant