Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision |
rfc:zendsignals [2008/08/05 10:25] – change patch date lucas | rfc:zendsignals [2011/05/31 22:50] – oops philip |
---|
* Status: Under Discussion | * Status: Under Discussion |
* First Proposed by: [[http://markmail.org/message/3jg6cwqfghdlydhy|Rasmus Lerdorf]] | * First Proposed by: [[http://markmail.org/message/3jg6cwqfghdlydhy|Rasmus Lerdorf]] |
* Source code: [[http://arnaud.lb.s3.amazonaws.com/php-5.3.0-alarms-0808051122.patch|PHP_5_3_0 patch]] [[http://arnaud.lb.s3.amazonaws.com/php-HEAD-alarms-0808051122.patch|PHP_HEAD patch]] (08-05-2008). | * Source code: [[http://tekrat.com/downloads/bits/php-5.3-signals.20091120.patch|PHP_5_3 patch]] [[http://tekrat.com/downloads/bits/php-trunk-signals.20091120.patch|PHP Trunk patch]] (11-20-2009). |
| |
===== Introduction ===== | ===== Introduction ===== |
===== Discoveries ===== | ===== Discoveries ===== |
=== pcntl extension signals === | === pcntl extension signals === |
The experimental pcntl extension allows signal handlers to be defined in PHP userspace via //[[http://docs.php.net/manual/en/function.pcntl-signal.php|pctnl_signal()]]//. The handler is installed via //signal// and any previously registered handlers for the specified signal are ignored. While this is technically incompatible with Zend Signals, if a handler is installed via //pctnl_signal// for signals SIGALRM, SIGHUP, SIGINT, SIGQUIT, SIGTERM, SIGUSR1, SIGUSR2, the deferred protection offered by Zend Signals will basically be disabled for that signal number. | The pcntl extension allows signal handlers to be defined in PHP userspace via //[[http://docs.php.net/manual/en/function.pcntl-signal.php|pctnl_signal()]]//. The handler is installed via //signal// and any previously registered handlers for the specified signal are ignored. While this is technically incompatible with Zend Signals, if a handler is installed via //pctnl_signal// for signals SIGALRM, SIGHUP, SIGINT, SIGQUIT, SIGTERM, SIGUSR1, SIGUSR2, the deferred protection offered by Zend Signals will basically be disabled for that signal number. |
| |
Future versions of Zend Signal should improve //zend_signal()// so extensions such as pcntl can register signals through Zend and still protect critical sections. | |
| |
Note: Although --enable-pcntl states "(CLI/CGI only)" in the config.m4, there is no actual enforcement of this at compile time. The extension can be running in any SAPI. | Note: Although --enable-pcntl states "(CLI/CGI only)" in the config.m4, there is no actual enforcement of this at compile time. The extension can be running in any SAPI. |
| |
| Update: pcntl has been modified to register signals via //zend_signal()// when available. Critical sections will now continue to have deferred protection even after signals are registered via pcntl. |
| |
=== PHP SIGCHLD signal handler === | === PHP SIGCHLD signal handler === |
| |
Note: When calling //wait()// or //waitpid()// within a handler the global errno may be modified. I have modified the existing handler in this patch to account for this. | Note: When calling //wait()// or //waitpid()// within a handler the global errno may be modified. I have modified the existing handler in this patch to account for this. |
| |
| |
===== Changelog ===== | ===== Changelog ===== |
| |
- 2008-07-05 Lucas Nealan: Initial creation | - 2008-07-05 Lucas Nealan: Initial creation ([[http://markmail.org/thread/di2fr6vzovagqofc|Discussed on internals]]) |
- 2008-07-08 Lucas Nealan: Updated patch for php_request_shutdown order issue ([[http://sizzo.org/~screen/patches/php-5.3.0-alarms-0807051839.patch|prev patch]]) | - 2008-07-08 Lucas Nealan: Updated patch for php_request_shutdown order issue ([[http://sizzo.org/~screen/patches/php-5.3.0-alarms-0807051839.patch|prev patch]]) |
- 2008-07-29 Lucas Nealan: Update patch to fix reentrance in handler, enable by default, stolen signal reporting ([[http://sizzo.org/~screen/patches/php-5.3.0-alarms-0807081632.patch|prev patch]]) | - 2008-07-29 Lucas Nealan: Update patch to fix reentrance in handler, enable by default, stolen signal reporting ([[http://sizzo.org/~screen/patches/php-5.3.0-alarms-0807081632.patch|prev patch]]) |
- 2008-08-03 Lucas Nealan: Incorporated ZTS support by Arnaud Le Blanc, moved ini def to zend.c, added HEAD patch ([[http://sizzo.org/~screen/patches/php-5.3.0-alarms-0808010408.patch|prev patch]]) | - 2008-08-03 Lucas Nealan: Incorporated ZTS support by Arnaud Le Blanc, moved ini def to zend.c, added HEAD patch ([[http://sizzo.org/~screen/patches/php-5.3.0-alarms-0808010408.patch|prev patch]]) |
- 2008-08-05 Arnaud Le Blanc: Added zend_sigaction() and ported PCNTL to use it. ([[http://sizzo.org/~screen/patches/php-5.3.0-alarms-0808021704.patch|PHP_5_3_0 prev patch]] [[http://sizzo.org/~screen/patches/php-HEAD-alarms-0808021832.patch|PHP_HEAD prev patch]]) | - 2008-08-05 Arnaud Le Blanc: Added zend_sigaction() and ported PCNTL to use it. ([[http://sizzo.org/~screen/patches/php-5.3.0-alarms-0808021704.patch|PHP_5_3_0 prev patch]] [[http://sizzo.org/~screen/patches/php-HEAD-alarms-0808021832.patch|PHP_HEAD prev patch]]) |
| - 2008-08-12 Lucas Nealan: Update patches to latest CVS, minor TWS fixes etc. ([[http://arnaud.lb.s3.amazonaws.com/php-5.3.0-alarms-0808051122.patch|PHP_5_3_0 prev patc]] [[http://arnaud.lb.s3.amazonaws.com/php-HEAD-alarms-0808051122.patch|PHP_HEAD prev patch]]) |
| - 2009-11-20 Brian Shire: Updated patches for latest CVS with some fixes for bugs caused by another fix to the handling of signals during user-space shutdown functions. ([[http://sizzo.org/~screen/patches/php-5.3.0-alarms-0808121020.patch|PHP_5_3_0 prev patch]] [[http://sizzo.org/~screen/patches/php-HEAD-alarms-0808121015.patch|PHP_HEAD prev patch]]) |