diff options
Diffstat (limited to 'ext/pcntl/php_signal.c')
-rw-r--r-- | ext/pcntl/php_signal.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/ext/pcntl/php_signal.c b/ext/pcntl/php_signal.c index 348503bae..c6da76397 100644 --- a/ext/pcntl/php_signal.c +++ b/ext/pcntl/php_signal.c @@ -18,14 +18,21 @@ /* $Id: php_signal.c 321634 2012-01-01 13:15:04Z felipe $ */ +#include "TSRM.h" #include "php_signal.h" +#include "Zend/zend.h" +#include "Zend/zend_signal.h" /* php_signal using sigaction is derrived from Advanced Programing * in the Unix Environment by W. Richard Stevens p 298. */ Sigfunc *php_signal4(int signo, Sigfunc *func, int restart, int mask_all) { struct sigaction act,oact; +#ifdef ZEND_SIGNALS + TSRMLS_FETCH(); +#endif act.sa_handler = func; + if (mask_all) { sigfillset(&act.sa_mask); } else { @@ -41,9 +48,15 @@ Sigfunc *php_signal4(int signo, Sigfunc *func, int restart, int mask_all) act.sa_flags |= SA_RESTART; /* SVR4, 4.3+BSD */ #endif } +#ifdef ZEND_SIGNALS + if (zend_sigaction(signo, &act, &oact TSRMLS_CC) < 0) +#else if (sigaction(signo, &act, &oact) < 0) +#endif + { return SIG_ERR; - + } + return oact.sa_handler; } |