diff options
Diffstat (limited to 'ext/pcntl')
| -rw-r--r-- | ext/pcntl/pcntl.c | 226 | ||||
| -rw-r--r-- | ext/pcntl/pcntl.stub.php | 74 | ||||
| -rw-r--r-- | ext/pcntl/pcntl_arginfo.h | 117 | ||||
| -rw-r--r-- | ext/pcntl/php_pcntl.h | 2 | ||||
| -rw-r--r-- | ext/pcntl/php_signal.c | 2 | ||||
| -rw-r--r-- | ext/pcntl/php_signal.h | 2 | ||||
| -rw-r--r-- | ext/pcntl/tests/pcntl_alarm.phpt | 3 | ||||
| -rw-r--r-- | ext/pcntl/tests/pcntl_exec_3.phpt | 4 | ||||
| -rw-r--r-- | ext/pcntl/tests/pcntl_signal.phpt | 4 | ||||
| -rw-r--r-- | ext/pcntl/tests/pcntl_wait.phpt | 33 |
10 files changed, 250 insertions, 217 deletions
diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c index cd85080c9b..254c025ef8 100644 --- a/ext/pcntl/pcntl.c +++ b/ext/pcntl/pcntl.c @@ -1,7 +1,5 @@ /* +----------------------------------------------------------------------+ - | PHP Version 7 | - +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | @@ -33,6 +31,7 @@ #include "php_ini.h" #include "ext/standard/info.h" #include "php_pcntl.h" +#include "pcntl_arginfo.h" #include "php_signal.h" #include "php_ticks.h" @@ -58,132 +57,13 @@ ZEND_DECLARE_MODULE_GLOBALS(pcntl) static PHP_GINIT_FUNCTION(pcntl); -/* {{{ arginfo */ -ZEND_BEGIN_ARG_INFO(arginfo_pcntl_void, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_waitpid, 0, 0, 2) - ZEND_ARG_INFO(0, pid) - ZEND_ARG_INFO(1, status) - ZEND_ARG_INFO(0, options) - ZEND_ARG_INFO(1, rusage) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_wait, 0, 0, 1) - ZEND_ARG_INFO(1, status) - ZEND_ARG_INFO(0, options) - ZEND_ARG_INFO(1, rusage) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_signal, 0, 0, 2) - ZEND_ARG_INFO(0, signo) - ZEND_ARG_INFO(0, handler) - ZEND_ARG_INFO(0, restart_syscalls) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_signal_get_handler, 0, 0, 1) - ZEND_ARG_INFO(0, signo) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_sigprocmask, 0, 0, 2) - ZEND_ARG_INFO(0, how) - ZEND_ARG_INFO(0, set) - ZEND_ARG_INFO(1, oldset) -ZEND_END_ARG_INFO() - -#ifdef HAVE_STRUCT_SIGINFO_T -# if HAVE_SIGWAITINFO && HAVE_SIGTIMEDWAIT -ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_sigwaitinfo, 0, 0, 1) - ZEND_ARG_INFO(0, set) - ZEND_ARG_INFO(1, info) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_sigtimedwait, 0, 0, 1) - ZEND_ARG_INFO(0, set) - ZEND_ARG_INFO(1, info) - ZEND_ARG_INFO(0, seconds) - ZEND_ARG_INFO(0, nanoseconds) -ZEND_END_ARG_INFO() -# endif -#endif - -ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_wifexited, 0, 0, 1) - ZEND_ARG_INFO(0, status) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_wifstopped, 0, 0, 1) - ZEND_ARG_INFO(0, status) -ZEND_END_ARG_INFO() - -#ifdef HAVE_WCONTINUED -ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_wifcontinued, 0, 0, 1) - ZEND_ARG_INFO(0, status) -ZEND_END_ARG_INFO() -#endif - -ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_wifsignaled, 0, 0, 1) - ZEND_ARG_INFO(0, status) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_wifexitstatus, 0, 0, 1) - ZEND_ARG_INFO(0, status) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_wtermsig, 0, 0, 1) - ZEND_ARG_INFO(0, status) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_wstopsig, 0, 0, 1) - ZEND_ARG_INFO(0, status) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_exec, 0, 0, 1) - ZEND_ARG_INFO(0, path) - ZEND_ARG_INFO(0, args) - ZEND_ARG_INFO(0, envs) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_alarm, 0, 0, 1) - ZEND_ARG_INFO(0, seconds) -ZEND_END_ARG_INFO() - -#ifdef HAVE_GETPRIORITY -ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_getpriority, 0, 0, 0) - ZEND_ARG_INFO(0, pid) - ZEND_ARG_INFO(0, process_identifier) -ZEND_END_ARG_INFO() -#endif - -#ifdef HAVE_SETPRIORITY -ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_setpriority, 0, 0, 1) - ZEND_ARG_INFO(0, priority) - ZEND_ARG_INFO(0, pid) - ZEND_ARG_INFO(0, process_identifier) -ZEND_END_ARG_INFO() -#endif - -ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_strerror, 0, 0, 1) - ZEND_ARG_INFO(0, errno) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_async_signals, 0, 0, 1) - ZEND_ARG_INFO(0, on) -ZEND_END_ARG_INFO() - -#ifdef HAVE_UNSHARE -ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_unshare, 0, 0, 1) - ZEND_ARG_INFO(0, flags) -ZEND_END_ARG_INFO() -#endif -/* }}} */ - static const zend_function_entry pcntl_functions[] = { - PHP_FE(pcntl_fork, arginfo_pcntl_void) + PHP_FE(pcntl_fork, arginfo_pcntl_fork) PHP_FE(pcntl_waitpid, arginfo_pcntl_waitpid) PHP_FE(pcntl_wait, arginfo_pcntl_wait) PHP_FE(pcntl_signal, arginfo_pcntl_signal) PHP_FE(pcntl_signal_get_handler, arginfo_pcntl_signal_get_handler) - PHP_FE(pcntl_signal_dispatch, arginfo_pcntl_void) + PHP_FE(pcntl_signal_dispatch, arginfo_pcntl_signal_dispatch) PHP_FE(pcntl_wifexited, arginfo_pcntl_wifexited) PHP_FE(pcntl_wifstopped, arginfo_pcntl_wifstopped) PHP_FE(pcntl_wifsignaled, arginfo_pcntl_wifsignaled) @@ -192,8 +72,8 @@ static const zend_function_entry pcntl_functions[] = { PHP_FE(pcntl_wstopsig, arginfo_pcntl_wstopsig) PHP_FE(pcntl_exec, arginfo_pcntl_exec) PHP_FE(pcntl_alarm, arginfo_pcntl_alarm) - PHP_FE(pcntl_get_last_error, arginfo_pcntl_void) - PHP_FALIAS(pcntl_errno, pcntl_get_last_error, NULL) + PHP_FE(pcntl_get_last_error, arginfo_pcntl_get_last_error) + PHP_FALIAS(pcntl_errno, pcntl_get_last_error, arginfo_pcntl_get_last_error) PHP_FE(pcntl_strerror, arginfo_pcntl_strerror) #ifdef HAVE_GETPRIORITY PHP_FE(pcntl_getpriority, arginfo_pcntl_getpriority) @@ -642,6 +522,10 @@ PHP_FUNCTION(pcntl_fork) { pid_t id; + if (zend_parse_parameters_none() == FAILURE) { + return; + } + id = fork(); if (id == -1) { PCNTL_G(last_error) = errno; @@ -658,10 +542,11 @@ PHP_FUNCTION(pcntl_alarm) { zend_long seconds; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &seconds) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &seconds) == FAILURE) { return; + } - RETURN_LONG ((zend_long) alarm(seconds)); + RETURN_LONG((zend_long) alarm(seconds)); } /* }}} */ @@ -807,17 +692,17 @@ PHP_FUNCTION(pcntl_wait) Returns true if the child status code represents a successful exit */ PHP_FUNCTION(pcntl_wifexited) { -#ifdef WIFEXITED zend_long status_word; - int int_status_word; if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) { - return; + return; } - int_status_word = (int) status_word; - if (WIFEXITED(int_status_word)) +#ifdef WIFEXITED + int int_status_word = (int) status_word; + if (WIFEXITED(int_status_word)) { RETURN_TRUE; + } #endif RETURN_FALSE; @@ -828,18 +713,19 @@ PHP_FUNCTION(pcntl_wifexited) Returns true if the child status code represents a stopped process (WUNTRACED must have been used with waitpid) */ PHP_FUNCTION(pcntl_wifstopped) { -#ifdef WIFSTOPPED zend_long status_word; - int int_status_word; if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) { - return; + return; } - int_status_word = (int) status_word; - if (WIFSTOPPED(int_status_word)) +#ifdef WIFSTOPPED + int int_status_word = (int) status_word; + if (WIFSTOPPED(int_status_word)) { RETURN_TRUE; + } #endif + RETURN_FALSE; } /* }}} */ @@ -848,18 +734,19 @@ PHP_FUNCTION(pcntl_wifstopped) Returns true if the child status code represents a process that was terminated due to a signal */ PHP_FUNCTION(pcntl_wifsignaled) { -#ifdef WIFSIGNALED zend_long status_word; - int int_status_word; if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) { - return; + return; } - int_status_word = (int) status_word; - if (WIFSIGNALED(int_status_word)) +#ifdef WIFSIGNALED + int int_status_word = (int) status_word; + if (WIFSIGNALED(int_status_word)) { RETURN_TRUE; + } #endif + RETURN_FALSE; } /* }}} */ @@ -867,17 +754,17 @@ PHP_FUNCTION(pcntl_wifsignaled) Returns true if the child status code represents a process that was resumed due to a SIGCONT signal */ PHP_FUNCTION(pcntl_wifcontinued) { -#ifdef HAVE_WCONTINUED zend_long status_word; - int int_status_word; if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) { - return; + return; } - int_status_word = (int) status_word; - if (WIFCONTINUED(int_status_word)) +#ifdef HAVE_WCONTINUED + int int_status_word = (int) status_word; + if (WIFCONTINUED(int_status_word)) { RETURN_TRUE; + } #endif RETURN_FALSE; } @@ -888,15 +775,14 @@ PHP_FUNCTION(pcntl_wifcontinued) Returns the status code of a child's exit */ PHP_FUNCTION(pcntl_wexitstatus) { -#ifdef WEXITSTATUS zend_long status_word; - int int_status_word; if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) { - return; + return; } - int_status_word = (int) status_word; +#ifdef WEXITSTATUS + int int_status_word = (int) status_word; RETURN_LONG(WEXITSTATUS(int_status_word)); #else RETURN_FALSE; @@ -908,15 +794,14 @@ PHP_FUNCTION(pcntl_wexitstatus) Returns the number of the signal that terminated the process who's status code is passed */ PHP_FUNCTION(pcntl_wtermsig) { -#ifdef WTERMSIG zend_long status_word; - int int_status_word; if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) { - return; + return; } - int_status_word = (int) status_word; +#ifdef WTERMSIG + int int_status_word = (int) status_word; RETURN_LONG(WTERMSIG(int_status_word)); #else RETURN_FALSE; @@ -928,15 +813,14 @@ PHP_FUNCTION(pcntl_wtermsig) Returns the number of the signal that caused the process to stop who's status code is passed */ PHP_FUNCTION(pcntl_wstopsig) { -#ifdef WSTOPSIG zend_long status_word; - int int_status_word; if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) { - return; + return; } - int_status_word = (int) status_word; +#ifdef WSTOPSIG + int int_status_word = (int) status_word; RETURN_LONG(WSTOPSIG(int_status_word)); #else RETURN_FALSE; @@ -1151,6 +1035,10 @@ PHP_FUNCTION(pcntl_signal_get_handler) Dispatch signals to signal handlers */ PHP_FUNCTION(pcntl_signal_dispatch) { + if (zend_parse_parameters_none() == FAILURE) { + return; + } + pcntl_signal_dispatch(); RETURN_TRUE; } @@ -1352,7 +1240,7 @@ PHP_FUNCTION(pcntl_getpriority) int pri; if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ll", &pid, &who) == FAILURE) { - RETURN_FALSE; + return; } /* needs to be cleared, since any returned value is valid */ @@ -1425,7 +1313,11 @@ PHP_FUNCTION(pcntl_setpriority) Retrieve the error number set by the last pcntl function which failed. */ PHP_FUNCTION(pcntl_get_last_error) { - RETURN_LONG(PCNTL_G(last_error)); + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + RETURN_LONG(PCNTL_G(last_error)); } /* }}} */ @@ -1433,13 +1325,13 @@ PHP_FUNCTION(pcntl_get_last_error) Retrieve the system error message associated with the given errno. */ PHP_FUNCTION(pcntl_strerror) { - zend_long error; + zend_long error; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &error) == FAILURE) { - RETURN_FALSE; - } + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &error) == FAILURE) { + return; + } - RETURN_STRING(strerror(error)); + RETURN_STRING(strerror(error)); } /* }}} */ @@ -1545,7 +1437,7 @@ void pcntl_signal_dispatch() sigprocmask(SIG_SETMASK, &old_mask, NULL); } -/* {{{ proto bool pcntl_async_signals([bool on[) +/* {{{ proto bool pcntl_async_signals([bool on]) Enable/disable asynchronous signal handling and return the old setting. */ PHP_FUNCTION(pcntl_async_signals) { diff --git a/ext/pcntl/pcntl.stub.php b/ext/pcntl/pcntl.stub.php new file mode 100644 index 0000000000..1bb1f69709 --- /dev/null +++ b/ext/pcntl/pcntl.stub.php @@ -0,0 +1,74 @@ +<?php + +function pcntl_fork(): int {} + +function pcntl_waitpid(int $pid, &$status, int $options = 0, &$rusage = []): int {} + +function pcntl_wait(&$status, int $options = 0, &$rusage = []): int {} + +/** + * @param callable|int $handler + */ +function pcntl_signal(int $signo, $handler, bool $restart_syscalls = true): bool {} + +/** @return mixed */ +function pcntl_signal_get_handler(int $signo) {} + +function pcntl_signal_dispatch(): bool {} + +#ifdef HAVE_SIGPROCMASK +function pcntl_sigprocmask(int $how, array $set, &$oldset = null): bool {} +#endif + +#ifdef HAVE_STRUCT_SIGINFO_T +#if HAVE_SIGWAITINFO && HAVE_SIGTIMEDWAIT +/** @return int|false */ +function pcntl_sigwaitinfo(array $set, &$info = []) {} + +/** @return int|false */ +function pcntl_sigtimedwait(array $set, &$info = [], int $seconds = 0, int $nanoseconds = 0) {} +#endif +#endif + +function pcntl_wifexited(int $status): bool {} + +function pcntl_wifstopped(int $status): bool {} + +#ifdef HAVE_WCONTINUED +function pcntl_wifcontinued(int $status): bool {} +#endif + +function pcntl_wifsignaled(int $status): bool {} + +/** @return int|false */ +function pcntl_wifexitstatus(int $status) {} + +/** @return int|false */ +function pcntl_wtermsig(int $status) {} + +/** @return int|false */ +function pcntl_wstopsig(int $status) {} + +/** @return false */ +function pcntl_exec(string $path, array $args = [], array $envs = []): bool {} + +function pcntl_alarm(int $seconds): int {} + +function pcntl_get_last_error(): int {} + +#ifdef HAVE_GETPRIORITY +/** @return int|false */ +function pcntl_getpriority(int $pid = UNKNOWN, int $process_identifier = PRIO_PROCESS) {} +#endif + +#ifdef HAVE_SETPRIORITY +function pcntl_setpriority(int $priority, int $pid = UNKNOWN, int $process_identifier = PRIO_PROCESS): bool{} +#endif + +function pcntl_strerror(int $errno): string {} + +function pcntl_async_signals(bool $on = UNKNOWN): bool {} + +#ifdef HAVE_UNSHARE +function pcntl_unshare(int $flags): bool {} +#endif diff --git a/ext/pcntl/pcntl_arginfo.h b/ext/pcntl/pcntl_arginfo.h new file mode 100644 index 0000000000..21a1c6aabd --- /dev/null +++ b/ext/pcntl/pcntl_arginfo.h @@ -0,0 +1,117 @@ +/* This is a generated file, edit the .stub.php file instead. */ + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_fork, 0, 0, IS_LONG, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_waitpid, 0, 2, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, pid, IS_LONG, 0) + ZEND_ARG_INFO(1, status) + ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0) + ZEND_ARG_INFO(1, rusage) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_wait, 0, 1, IS_LONG, 0) + ZEND_ARG_INFO(1, status) + ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0) + ZEND_ARG_INFO(1, rusage) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_signal, 0, 2, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, signo, IS_LONG, 0) + ZEND_ARG_INFO(0, handler) + ZEND_ARG_TYPE_INFO(0, restart_syscalls, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_signal_get_handler, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, signo, IS_LONG, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_signal_dispatch, 0, 0, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +#if defined(HAVE_SIGPROCMASK) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_sigprocmask, 0, 2, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, how, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, set, IS_ARRAY, 0) + ZEND_ARG_INFO(1, oldset) +ZEND_END_ARG_INFO() +#endif + +#if defined(HAVE_STRUCT_SIGINFO_T) && HAVE_SIGWAITINFO && HAVE_SIGTIMEDWAIT +ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_sigwaitinfo, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, set, IS_ARRAY, 0) + ZEND_ARG_INFO(1, info) +ZEND_END_ARG_INFO() +#endif + +#if defined(HAVE_STRUCT_SIGINFO_T) && HAVE_SIGWAITINFO && HAVE_SIGTIMEDWAIT +ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_sigtimedwait, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, set, IS_ARRAY, 0) + ZEND_ARG_INFO(1, info) + ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, nanoseconds, IS_LONG, 0) +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_wifexited, 0, 1, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, status, IS_LONG, 0) +ZEND_END_ARG_INFO() + +#define arginfo_pcntl_wifstopped arginfo_pcntl_wifexited + +#if defined(HAVE_WCONTINUED) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_wifcontinued, 0, 1, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, status, IS_LONG, 0) +ZEND_END_ARG_INFO() +#endif + +#define arginfo_pcntl_wifsignaled arginfo_pcntl_wifexited + +ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_wifexitstatus, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, status, IS_LONG, 0) +ZEND_END_ARG_INFO() + +#define arginfo_pcntl_wtermsig arginfo_pcntl_wifexitstatus + +#define arginfo_pcntl_wstopsig arginfo_pcntl_wifexitstatus + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_exec, 0, 1, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, args, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, envs, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_alarm, 0, 1, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0) +ZEND_END_ARG_INFO() + +#define arginfo_pcntl_get_last_error arginfo_pcntl_fork + +#if defined(HAVE_GETPRIORITY) +ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_getpriority, 0, 0, 0) + ZEND_ARG_TYPE_INFO(0, pid, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, process_identifier, IS_LONG, 0) +ZEND_END_ARG_INFO() +#endif + +#if defined(HAVE_SETPRIORITY) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_setpriority, 0, 1, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, priority, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, pid, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, process_identifier, IS_LONG, 0) +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_strerror, 0, 1, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, errno, IS_LONG, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_async_signals, 0, 0, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, on, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +#if defined(HAVE_UNSHARE) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_unshare, 0, 1, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0) +ZEND_END_ARG_INFO() +#endif diff --git a/ext/pcntl/php_pcntl.h b/ext/pcntl/php_pcntl.h index 90ce2aea96..bbb07bc896 100644 --- a/ext/pcntl/php_pcntl.h +++ b/ext/pcntl/php_pcntl.h @@ -1,7 +1,5 @@ /* +----------------------------------------------------------------------+ - | PHP Version 7 | - +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | diff --git a/ext/pcntl/php_signal.c b/ext/pcntl/php_signal.c index 93a42f45d1..ba65996c1d 100644 --- a/ext/pcntl/php_signal.c +++ b/ext/pcntl/php_signal.c @@ -1,7 +1,5 @@ /* +----------------------------------------------------------------------+ - | PHP Version 7 | - +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | diff --git a/ext/pcntl/php_signal.h b/ext/pcntl/php_signal.h index b392b25d6e..21dbf0d254 100644 --- a/ext/pcntl/php_signal.h +++ b/ext/pcntl/php_signal.h @@ -1,7 +1,5 @@ /* +----------------------------------------------------------------------+ - | PHP Version 7 | - +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | diff --git a/ext/pcntl/tests/pcntl_alarm.phpt b/ext/pcntl/tests/pcntl_alarm.phpt index a9cae1616b..337ba3ad4b 100644 --- a/ext/pcntl/tests/pcntl_alarm.phpt +++ b/ext/pcntl/tests/pcntl_alarm.phpt @@ -8,7 +8,6 @@ max_execution_time=0 <?php pcntl_signal(SIGALRM, function(){}); -var_dump(pcntl_alarm()); pcntl_alarm(0); var_dump(pcntl_alarm(60)); var_dump(pcntl_alarm(1) > 0); @@ -16,8 +15,6 @@ $siginfo = array(); var_dump(pcntl_sigtimedwait(array(SIGALRM),$siginfo,2) === SIGALRM); ?> --EXPECTF-- -Warning: pcntl_alarm() expects exactly 1 parameter, 0 given in %s -NULL int(0) bool(true) bool(true) diff --git a/ext/pcntl/tests/pcntl_exec_3.phpt b/ext/pcntl/tests/pcntl_exec_3.phpt index 5349381d92..7d7f6b5271 100644 --- a/ext/pcntl/tests/pcntl_exec_3.phpt +++ b/ext/pcntl/tests/pcntl_exec_3.phpt @@ -4,14 +4,10 @@ pcntl_exec() 3 <?php if (!extension_loaded("pcntl")) print "skip"; ?> --FILE-- <?php -var_dump(pcntl_exec()); $file = tempnam(sys_get_temp_dir(),"php"); var_dump(pcntl_exec($file, array("foo","bar"), array("foo" => "bar"))); unlink($file); ?> --EXPECTF-- -Warning: pcntl_exec() expects at least 1 parameter, 0 given %s -NULL - Warning: pcntl_exec(): Error has occurred: (errno %d) %s bool(false) diff --git a/ext/pcntl/tests/pcntl_signal.phpt b/ext/pcntl/tests/pcntl_signal.phpt index a6441935c1..5bba18c2a0 100644 --- a/ext/pcntl/tests/pcntl_signal.phpt +++ b/ext/pcntl/tests/pcntl_signal.phpt @@ -17,7 +17,6 @@ pcntl_signal(SIGUSR1, function($signo, $siginfo){ posix_kill(posix_getpid(), SIGUSR1); pcntl_signal_dispatch(); -var_dump(pcntl_signal()); var_dump(pcntl_signal(SIGALRM, SIG_IGN)); var_dump(pcntl_signal(-1, -1)); var_dump(pcntl_signal(-1, function(){})); @@ -31,9 +30,6 @@ echo "ok\n"; --EXPECTF-- signal dispatched got signal from %r\d+|nobody%r - -Warning: pcntl_signal() expects at least 2 parameters, 0 given in %s -NULL bool(true) Warning: pcntl_signal(): Invalid signal %s diff --git a/ext/pcntl/tests/pcntl_wait.phpt b/ext/pcntl/tests/pcntl_wait.phpt index d5ab709b76..c745a21dc7 100644 --- a/ext/pcntl/tests/pcntl_wait.phpt +++ b/ext/pcntl/tests/pcntl_wait.phpt @@ -20,15 +20,6 @@ if ($pid == -1) { var_dump(pcntl_wexitstatus($status)); var_dump(pcntl_wait($status, WNOHANG | WUNTRACED)); - var_dump(pcntl_wait()); - var_dump(pcntl_waitpid()); - - var_dump(pcntl_wifexited()); - var_dump(pcntl_wifstopped()); - var_dump(pcntl_wifsignaled()); - var_dump(pcntl_wexitstatus()); - var_dump(pcntl_wtermsig()); - var_dump(pcntl_wstopsig()); } else { posix_kill(posix_getpid(), SIGSTOP); exit(42); @@ -40,27 +31,3 @@ bool(false) bool(false) int(42) int(-1) - -Warning: pcntl_wait() expects at least 1 parameter, 0 given in %s -NULL - -Warning: pcntl_waitpid() expects at least 2 parameters, 0 given in %s -NULL - -Warning: pcntl_wifexited() expects exactly 1 parameter, 0 given in %s -NULL - -Warning: pcntl_wifstopped() expects exactly 1 parameter, 0 given in %s -NULL - -Warning: pcntl_wifsignaled() expects exactly 1 parameter, 0 given in %s -NULL - -Warning: pcntl_wexitstatus() expects exactly 1 parameter, 0 given in %s -NULL - -Warning: pcntl_wtermsig() expects exactly 1 parameter, 0 given in %s -NULL - -Warning: pcntl_wstopsig() expects exactly 1 parameter, 0 given in %s -NULL |
