diff options
Diffstat (limited to 'ext/pcntl/pcntl.c')
-rw-r--r-- | ext/pcntl/pcntl.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c index 36d2a672ab..c6236f9663 100644 --- a/ext/pcntl/pcntl.c +++ b/ext/pcntl/pcntl.c @@ -16,8 +16,6 @@ +----------------------------------------------------------------------+ */ -/* $Id$ */ - #define PCNTL_DEBUG 0 #if PCNTL_DEBUG @@ -170,7 +168,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_async_signals, 0, 0, 1) ZEND_END_ARG_INFO() /* }}} */ -const zend_function_entry pcntl_functions[] = { +static const zend_function_entry pcntl_functions[] = { PHP_FE(pcntl_fork, arginfo_pcntl_void) PHP_FE(pcntl_waitpid, arginfo_pcntl_waitpid) PHP_FE(pcntl_wait, arginfo_pcntl_wait) @@ -622,7 +620,7 @@ PHP_FUNCTION(pcntl_alarm) #define PHP_RUSAGE_PARA(from, to, field) \ add_assoc_long(to, #field, from.field) -#if !defined(_OSD_POSIX) && !defined(__BEOS__) /* BS2000 has only a few fields in the rusage struct */ +#ifndef _OSD_POSIX #define PHP_RUSAGE_SPECIAL(from, to) \ PHP_RUSAGE_PARA(from, to, ru_oublock); \ PHP_RUSAGE_PARA(from, to, ru_inblock); \ @@ -674,7 +672,7 @@ PHP_FUNCTION(pcntl_waitpid) #ifdef HAVE_WAIT4 if (z_rusage) { if (Z_TYPE_P(z_rusage) != IS_ARRAY) { - zval_dtor(z_rusage); + zval_ptr_dtor(z_rusage); array_init(z_rusage); } else { zend_hash_clean(Z_ARRVAL_P(z_rusage)); @@ -699,7 +697,7 @@ PHP_FUNCTION(pcntl_waitpid) } #endif - zval_dtor(z_status); + zval_ptr_dtor(z_status); ZVAL_LONG(z_status, status); RETURN_LONG((zend_long) child_id); @@ -726,7 +724,7 @@ PHP_FUNCTION(pcntl_wait) #ifdef HAVE_WAIT3 if (z_rusage) { if (Z_TYPE_P(z_rusage) != IS_ARRAY) { - zval_dtor(z_rusage); + zval_ptr_dtor(z_rusage); array_init(z_rusage); } else { zend_hash_clean(Z_ARRVAL_P(z_rusage)); @@ -752,7 +750,7 @@ PHP_FUNCTION(pcntl_wait) } #endif - zval_dtor(z_status); + zval_ptr_dtor(z_status); ZVAL_LONG(z_status, status); RETURN_LONG((zend_long) child_id); @@ -972,7 +970,7 @@ PHP_FUNCTION(pcntl_exec) strlcat(*pair, Z_STRVAL_P(element), pair_length); /* Cleanup */ - zend_string_release(key); + zend_string_release_ex(key, 0); envi++; pair++; } ZEND_HASH_FOREACH_END(); @@ -1049,14 +1047,13 @@ PHP_FUNCTION(pcntl_signal) zend_string *func_name = zend_get_callable_name(handle); PCNTL_G(last_error) = EINVAL; php_error_docref(NULL, E_WARNING, "%s is not a callable function name error", ZSTR_VAL(func_name)); - zend_string_release(func_name); + zend_string_release_ex(func_name, 0); RETURN_FALSE; } /* Add the function name to our signal table */ - if (zend_hash_index_update(&PCNTL_G(php_signal_table), signo, handle)) { - if (Z_REFCOUNTED_P(handle)) Z_ADDREF_P(handle); - } + handle = zend_hash_index_update(&PCNTL_G(php_signal_table), signo, handle); + Z_TRY_ADDREF_P(handle); if (php_signal4(signo, pcntl_signal_handler, (int) restart_syscalls, 1) == (Sigfunc *)SIG_ERR) { PCNTL_G(last_error) = errno; @@ -1135,7 +1132,7 @@ PHP_FUNCTION(pcntl_sigprocmask) if (user_oldset != NULL) { if (Z_TYPE_P(user_oldset) != IS_ARRAY) { - zval_dtor(user_oldset); + zval_ptr_dtor(user_oldset); array_init(user_oldset); } else { zend_hash_clean(Z_ARRVAL_P(user_oldset)); @@ -1234,7 +1231,7 @@ static void pcntl_siginfo_to_zval(int signo, siginfo_t *siginfo, zval *user_sigi { if (signo > 0 && user_siginfo) { if (Z_TYPE_P(user_siginfo) != IS_ARRAY) { - zval_dtor(user_siginfo); + zval_ptr_dtor(user_siginfo); array_init(user_siginfo); } else { zend_hash_clean(Z_ARRVAL_P(user_siginfo)); @@ -1469,8 +1466,9 @@ void pcntl_signal_dispatch() /* FIXME: this is probably broken when multiple signals are handled in this while loop (retval) */ call_user_function(EG(function_table), NULL, handle, &retval, 2, params); zval_ptr_dtor(&retval); - zval_ptr_dtor(¶ms[0]); +#ifdef HAVE_STRUCT_SIGINFO_T zval_ptr_dtor(¶ms[1]); +#endif } } |