From 34d93f0c06706500d290424a757b6e4f7645bc78 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Wed, 22 Jun 2011 14:23:21 +0000 Subject: Zend Signal Handling --- ext/pcntl/php_signal.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'ext/pcntl/php_signal.c') diff --git a/ext/pcntl/php_signal.c b/ext/pcntl/php_signal.c index 00ab6b425f..92ec411314 100644 --- a/ext/pcntl/php_signal.c +++ b/ext/pcntl/php_signal.c @@ -18,6 +18,7 @@ /* $Id$ */ +#include "TSRM.h" #include "php_signal.h" /* php_signal using sigaction is derrived from Advanced Programing @@ -26,6 +27,10 @@ Sigfunc *php_signal4(int signo, Sigfunc *func, int restart, int mask_all) { struct sigaction act,oact; act.sa_handler = func; +#ifdef ZEND_SIGNALS + TSRMLS_FETCH(); +#endif + if (mask_all) { sigfillset(&act.sa_mask); } else { @@ -41,9 +46,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; } -- cgit v1.2.1