@@ -185,12 +185,8 @@ ZEND_GET_MODULE(pcntl)
185185
186186static void (* orig_interrupt_function )(zend_execute_data * execute_data );
187187
188- #ifdef HAVE_STRUCT_SIGINFO_T
189188static void pcntl_signal_handler (int , siginfo_t * , void * );
190189static void pcntl_siginfo_to_zval (int , siginfo_t * , zval * );
191- #else
192- static void pcntl_signal_handler (int );
193- #endif
194190static void pcntl_signal_dispatch (void );
195191static void pcntl_signal_dispatch_tick_function (int dummy_int , void * dummy_pointer );
196192static void pcntl_interrupt_function (zend_execute_data * execute_data );
@@ -240,7 +236,7 @@ PHP_RSHUTDOWN_FUNCTION(pcntl)
240236 /* Reset all signals to their default disposition */
241237 ZEND_HASH_FOREACH_NUM_KEY_VAL (& PCNTL_G (php_signal_table ), signo , handle ) {
242238 if (Z_TYPE_P (handle ) != IS_LONG || Z_LVAL_P (handle ) != (zend_long )SIG_DFL ) {
243- php_signal (signo , (Sigfunc * )(zend_long )SIG_DFL , 0 );
239+ php_signal (signo , (Sigfunc * )(zend_long )SIG_DFL , false );
244240 }
245241 } ZEND_HASH_FOREACH_END ();
246242
@@ -835,7 +831,7 @@ PHP_FUNCTION(pcntl_signal)
835831 zend_argument_value_error (2 , "must be either SIG_DFL or SIG_IGN when an integer value is given" );
836832 RETURN_THROWS ();
837833 }
838- if (php_signal (signo , (Sigfunc * ) Z_LVAL_P (handle ), ( int ) restart_syscalls ) == (void * )SIG_ERR ) {
834+ if (php_signal (signo , (Sigfunc * ) Z_LVAL_P (handle ), restart_syscalls ) == (void * )SIG_ERR ) {
839835 PCNTL_G (last_error ) = errno ;
840836 php_error_docref (NULL , E_WARNING , "Error assigning signal" );
841837 RETURN_FALSE ;
@@ -1007,8 +1003,7 @@ PHP_FUNCTION(pcntl_sigprocmask)
10071003/* }}} */
10081004#endif
10091005
1010- #ifdef HAVE_STRUCT_SIGINFO_T
1011- # ifdef HAVE_SIGWAITINFO
1006+ #ifdef HAVE_SIGWAITINFO
10121007
10131008/* {{{ Synchronously wait for queued signals */
10141009PHP_FUNCTION (pcntl_sigwaitinfo )
@@ -1050,8 +1045,9 @@ PHP_FUNCTION(pcntl_sigwaitinfo)
10501045 RETURN_LONG (signal_no );
10511046}
10521047/* }}} */
1053- # endif
1054- # ifdef HAVE_SIGTIMEDWAIT
1048+ #endif
1049+
1050+ #ifdef HAVE_SIGTIMEDWAIT
10551051/* {{{ Wait for queued signals */
10561052PHP_FUNCTION (pcntl_sigtimedwait )
10571053{
@@ -1113,7 +1109,7 @@ PHP_FUNCTION(pcntl_sigtimedwait)
11131109 RETURN_LONG (signal_no );
11141110}
11151111/* }}} */
1116- # endif
1112+ #endif
11171113
11181114static void pcntl_siginfo_to_zval (int signo , siginfo_t * siginfo , zval * user_siginfo ) /* {{{ */
11191115{
@@ -1183,7 +1179,6 @@ static void pcntl_siginfo_to_zval(int signo, siginfo_t *siginfo, zval *user_sigi
11831179 }
11841180}
11851181/* }}} */
1186- #endif
11871182
11881183#ifdef HAVE_GETPRIORITY
11891184/* {{{ Get the priority of any process */
@@ -1325,11 +1320,7 @@ PHP_FUNCTION(pcntl_strerror)
13251320/* }}} */
13261321
13271322/* Our custom signal handler that calls the appropriate php_function */
1328- #ifdef HAVE_STRUCT_SIGINFO_T
13291323static void pcntl_signal_handler (int signo , siginfo_t * siginfo , void * context )
1330- #else
1331- static void pcntl_signal_handler (int signo )
1332- #endif
13331324{
13341325 struct php_pcntl_pending_signal * psig = PCNTL_G (spares );
13351326 if (!psig ) {
@@ -1341,9 +1332,7 @@ static void pcntl_signal_handler(int signo)
13411332 psig -> signo = signo ;
13421333 psig -> next = NULL ;
13431334
1344- #ifdef HAVE_STRUCT_SIGINFO_T
13451335 psig -> siginfo = * siginfo ;
1346- #endif
13471336
13481337 /* the head check is important, as the tick handler cannot atomically clear both
13491338 * the head and tail */
@@ -1395,19 +1384,14 @@ void pcntl_signal_dispatch(void)
13951384 if ((handle = zend_hash_index_find (& PCNTL_G (php_signal_table ), queue -> signo )) != NULL ) {
13961385 if (Z_TYPE_P (handle ) != IS_LONG ) {
13971386 ZVAL_LONG (& params [0 ], queue -> signo );
1398- #ifdef HAVE_STRUCT_SIGINFO_T
13991387 array_init (& params [1 ]);
14001388 pcntl_siginfo_to_zval (queue -> signo , & queue -> siginfo , & params [1 ]);
1401- #else
1402- ZVAL_NULL (& params [1 ]);
1403- #endif
14041389
14051390 /* Call php signal handler - Note that we do not report errors, and we ignore the return value */
14061391 call_user_function (NULL , NULL , handle , & retval , 2 , params );
14071392 zval_ptr_dtor (& retval );
1408- #ifdef HAVE_STRUCT_SIGINFO_T
14091393 zval_ptr_dtor (& params [1 ]);
1410- #endif
1394+
14111395 if (EG (exception )) {
14121396 break ;
14131397 }
0 commit comments