@@ -104,12 +104,8 @@ ZEND_GET_MODULE(pcntl)
104104
105105static void (* orig_interrupt_function )(zend_execute_data * execute_data );
106106
107- #ifdef HAVE_STRUCT_SIGINFO_T
108107static void pcntl_signal_handler (int , siginfo_t * , void * );
109108static void pcntl_siginfo_to_zval (int , siginfo_t * , zval * );
110- #else
111- static void pcntl_signal_handler (int );
112- #endif
113109static void pcntl_signal_dispatch (void );
114110static void pcntl_signal_dispatch_tick_function (int dummy_int , void * dummy_pointer );
115111static void pcntl_interrupt_function (zend_execute_data * execute_data );
@@ -166,7 +162,7 @@ PHP_RSHUTDOWN_FUNCTION(pcntl)
166162 /* Reset all signals to their default disposition */
167163 ZEND_HASH_FOREACH_NUM_KEY_VAL (& PCNTL_G (php_signal_table ), signo , handle ) {
168164 if (Z_TYPE_P (handle ) != IS_LONG || Z_LVAL_P (handle ) != (zend_long )SIG_DFL ) {
169- php_signal (signo , (Sigfunc * )(zend_long )SIG_DFL , 0 );
165+ php_signal (signo , (Sigfunc * )(zend_long )SIG_DFL , false );
170166 }
171167 } ZEND_HASH_FOREACH_END ();
172168
@@ -662,7 +658,7 @@ PHP_FUNCTION(pcntl_signal)
662658 zend_argument_value_error (2 , "must be either SIG_DFL or SIG_IGN when an integer value is given" );
663659 RETURN_THROWS ();
664660 }
665- if (php_signal (signo , (Sigfunc * ) Z_LVAL_P (handle ), ( int ) restart_syscalls ) == (void * )SIG_ERR ) {
661+ if (php_signal (signo , (Sigfunc * ) Z_LVAL_P (handle ), restart_syscalls ) == (void * )SIG_ERR ) {
666662 PCNTL_G (last_error ) = errno ;
667663 php_error_docref (NULL , E_WARNING , "Error assigning signal" );
668664 RETURN_FALSE ;
@@ -682,7 +678,7 @@ PHP_FUNCTION(pcntl_signal)
682678 handle = zend_hash_index_update (& PCNTL_G (php_signal_table ), signo , handle );
683679 Z_TRY_ADDREF_P (handle );
684680
685- if (php_signal4 (signo , pcntl_signal_handler , ( int ) restart_syscalls , 1 ) == (void * )SIG_ERR ) {
681+ if (php_signal4 (signo , pcntl_signal_handler , restart_syscalls , true ) == (void * )SIG_ERR ) {
686682 PCNTL_G (last_error ) = errno ;
687683 php_error_docref (NULL , E_WARNING , "Error assigning signal" );
688684 RETURN_FALSE ;
@@ -841,8 +837,7 @@ PHP_FUNCTION(pcntl_sigprocmask)
841837/* }}} */
842838#endif
843839
844- #ifdef HAVE_STRUCT_SIGINFO_T
845- # ifdef HAVE_SIGWAITINFO
840+ #ifdef HAVE_SIGWAITINFO
846841
847842/* {{{ Synchronously wait for queued signals */
848843PHP_FUNCTION (pcntl_sigwaitinfo )
@@ -884,8 +879,9 @@ PHP_FUNCTION(pcntl_sigwaitinfo)
884879 RETURN_LONG (signal_no );
885880}
886881/* }}} */
887- # endif
888- # ifdef HAVE_SIGTIMEDWAIT
882+ #endif
883+
884+ #ifdef HAVE_SIGTIMEDWAIT
889885/* {{{ Wait for queued signals */
890886PHP_FUNCTION (pcntl_sigtimedwait )
891887{
@@ -947,7 +943,7 @@ PHP_FUNCTION(pcntl_sigtimedwait)
947943 RETURN_LONG (signal_no );
948944}
949945/* }}} */
950- # endif
946+ #endif
951947
952948static void pcntl_siginfo_to_zval (int signo , siginfo_t * siginfo , zval * user_siginfo ) /* {{{ */
953949{
@@ -1003,7 +999,6 @@ static void pcntl_siginfo_to_zval(int signo, siginfo_t *siginfo, zval *user_sigi
1003999 }
10041000}
10051001/* }}} */
1006- #endif
10071002
10081003#ifdef HAVE_GETPRIORITY
10091004/* {{{ Get the priority of any process */
@@ -1145,11 +1140,7 @@ PHP_FUNCTION(pcntl_strerror)
11451140/* }}} */
11461141
11471142/* Our custom signal handler that calls the appropriate php_function */
1148- #ifdef HAVE_STRUCT_SIGINFO_T
11491143static void pcntl_signal_handler (int signo , siginfo_t * siginfo , void * context )
1150- #else
1151- static void pcntl_signal_handler (int signo )
1152- #endif
11531144{
11541145 struct php_pcntl_pending_signal * psig = PCNTL_G (spares );
11551146 if (!psig ) {
@@ -1161,9 +1152,7 @@ static void pcntl_signal_handler(int signo)
11611152 psig -> signo = signo ;
11621153 psig -> next = NULL ;
11631154
1164- #ifdef HAVE_STRUCT_SIGINFO_T
11651155 psig -> siginfo = * siginfo ;
1166- #endif
11671156
11681157 /* the head check is important, as the tick handler cannot atomically clear both
11691158 * the head and tail */
@@ -1215,20 +1204,14 @@ void pcntl_signal_dispatch(void)
12151204 if (Z_TYPE_P (handle ) != IS_LONG ) {
12161205 ZVAL_NULL (& retval );
12171206 ZVAL_LONG (& params [0 ], queue -> signo );
1218- #ifdef HAVE_STRUCT_SIGINFO_T
12191207 array_init (& params [1 ]);
12201208 pcntl_siginfo_to_zval (queue -> signo , & queue -> siginfo , & params [1 ]);
1221- #else
1222- ZVAL_NULL (& params [1 ]);
1223- #endif
12241209
12251210 /* Call php signal handler - Note that we do not report errors, and we ignore the return value */
12261211 /* FIXME: this is probably broken when multiple signals are handled in this while loop (retval) */
12271212 call_user_function (NULL , NULL , handle , & retval , 2 , params );
12281213 zval_ptr_dtor (& retval );
1229- #ifdef HAVE_STRUCT_SIGINFO_T
12301214 zval_ptr_dtor (& params [1 ]);
1231- #endif
12321215 }
12331216 }
12341217
0 commit comments