summaryrefslogtreecommitdiff
path: root/ext/pcntl/pcntl.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pcntl/pcntl.c')
-rw-r--r--ext/pcntl/pcntl.c86
1 files changed, 42 insertions, 44 deletions
diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c
index 1b5efed1c1..d26e691075 100644
--- a/ext/pcntl/pcntl.c
+++ b/ext/pcntl/pcntl.c
@@ -499,7 +499,7 @@ PHP_MINIT_FUNCTION(pcntl)
{
php_register_signal_constants(INIT_FUNC_ARGS_PASSTHRU);
php_pcntl_register_errno_constants(INIT_FUNC_ARGS_PASSTHRU);
- php_add_tick_function(pcntl_signal_dispatch TSRMLS_CC);
+ php_add_tick_function(pcntl_signal_dispatch);
return SUCCESS;
}
@@ -545,7 +545,7 @@ PHP_FUNCTION(pcntl_fork)
id = fork();
if (id == -1) {
PCNTL_G(last_error) = errno;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error %d", errno);
+ php_error_docref(NULL, E_WARNING, "Error %d", errno);
}
RETURN_LONG((zend_long) id);
@@ -558,7 +558,7 @@ PHP_FUNCTION(pcntl_alarm)
{
zend_long seconds;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &seconds) == FAILURE)
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &seconds) == FAILURE)
return;
RETURN_LONG ((zend_long) alarm(seconds));
@@ -574,7 +574,7 @@ PHP_FUNCTION(pcntl_waitpid)
int status;
pid_t child_id;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz/|l", &pid, &z_status, &options) == FAILURE)
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "lz/|l", &pid, &z_status, &options) == FAILURE)
return;
convert_to_long_ex(z_status);
@@ -602,7 +602,7 @@ PHP_FUNCTION(pcntl_wait)
int status;
pid_t child_id;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/|l", &z_status, &options) == FAILURE)
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z/|l", &z_status, &options) == FAILURE)
return;
convert_to_long_ex(z_status);
@@ -635,7 +635,7 @@ PHP_FUNCTION(pcntl_wifexited)
#ifdef WIFEXITED
zend_long status_word;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) {
return;
}
@@ -653,7 +653,7 @@ PHP_FUNCTION(pcntl_wifstopped)
#ifdef WIFSTOPPED
zend_long status_word;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) {
return;
}
@@ -671,7 +671,7 @@ PHP_FUNCTION(pcntl_wifsignaled)
#ifdef WIFSIGNALED
zend_long status_word;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) {
return;
}
@@ -689,7 +689,7 @@ PHP_FUNCTION(pcntl_wexitstatus)
#ifdef WEXITSTATUS
zend_long status_word;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) {
return;
}
@@ -707,7 +707,7 @@ PHP_FUNCTION(pcntl_wtermsig)
#ifdef WTERMSIG
zend_long status_word;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) {
return;
}
@@ -725,7 +725,7 @@ PHP_FUNCTION(pcntl_wstopsig)
#ifdef WSTOPSIG
zend_long status_word;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) {
return;
}
@@ -753,7 +753,7 @@ PHP_FUNCTION(pcntl_exec)
size_t path_len;
zend_ulong key_num;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|aa", &path, &path_len, &args, &envs) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|aa", &path, &path_len, &args, &envs) == FAILURE) {
return;
}
@@ -811,7 +811,7 @@ PHP_FUNCTION(pcntl_exec)
if (execve(path, argv, envp) == -1) {
PCNTL_G(last_error) = errno;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error has occurred: (errno %d) %s", errno, strerror(errno));
+ php_error_docref(NULL, E_WARNING, "Error has occurred: (errno %d) %s", errno, strerror(errno));
}
/* Cleanup */
@@ -821,7 +821,7 @@ PHP_FUNCTION(pcntl_exec)
if (execv(path, argv) == -1) {
PCNTL_G(last_error) = errno;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error has occurred: (errno %d) %s", errno, strerror(errno));
+ php_error_docref(NULL, E_WARNING, "Error has occurred: (errno %d) %s", errno, strerror(errno));
}
}
@@ -840,12 +840,12 @@ PHP_FUNCTION(pcntl_signal)
zend_long signo;
zend_bool restart_syscalls = 1;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz|b", &signo, &handle, &restart_syscalls) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "lz|b", &signo, &handle, &restart_syscalls) == FAILURE) {
return;
}
if (signo < 1 || signo > 32) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid signal");
+ php_error_docref(NULL, E_WARNING, "Invalid signal");
RETURN_FALSE;
}
@@ -865,21 +865,21 @@ PHP_FUNCTION(pcntl_signal)
/* Special long value case for SIG_DFL and SIG_IGN */
if (Z_TYPE_P(handle) == IS_LONG) {
if (Z_LVAL_P(handle) != (zend_long) SIG_DFL && Z_LVAL_P(handle) != (zend_long) SIG_IGN) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid value for handle argument specified");
+ php_error_docref(NULL, E_WARNING, "Invalid value for handle argument specified");
RETURN_FALSE;
}
if (php_signal(signo, (Sigfunc *) Z_LVAL_P(handle), (int) restart_syscalls) == SIG_ERR) {
PCNTL_G(last_error) = errno;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error assigning signal");
+ php_error_docref(NULL, E_WARNING, "Error assigning signal");
RETURN_FALSE;
}
zend_hash_index_del(&PCNTL_G(php_signal_table), signo);
RETURN_TRUE;
}
- if (!zend_is_callable(handle, 0, &func_name TSRMLS_CC)) {
+ if (!zend_is_callable(handle, 0, &func_name)) {
PCNTL_G(last_error) = EINVAL;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s is not a callable function name error", func_name->val);
+ php_error_docref(NULL, E_WARNING, "%s is not a callable function name error", func_name->val);
zend_string_release(func_name);
RETURN_FALSE;
}
@@ -892,7 +892,7 @@ PHP_FUNCTION(pcntl_signal)
if (php_signal4(signo, pcntl_signal_handler, (int) restart_syscalls, 1) == SIG_ERR) {
PCNTL_G(last_error) = errno;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error assigning signal");
+ php_error_docref(NULL, E_WARNING, "Error assigning signal");
RETURN_FALSE;
}
RETURN_TRUE;
@@ -917,13 +917,13 @@ PHP_FUNCTION(pcntl_sigprocmask)
zval *user_set, *user_oldset = NULL, *user_signo;
sigset_t set, oldset;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "la|z/", &how, &user_set, &user_oldset) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "la|z/", &how, &user_set, &user_oldset) == FAILURE) {
return;
}
if (sigemptyset(&set) != 0 || sigemptyset(&oldset) != 0) {
PCNTL_G(last_error) = errno;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
+ php_error_docref(NULL, E_WARNING, "%s", strerror(errno));
RETURN_FALSE;
}
@@ -935,14 +935,14 @@ PHP_FUNCTION(pcntl_sigprocmask)
signo = Z_LVAL_P(user_signo);
if (sigaddset(&set, signo) != 0) {
PCNTL_G(last_error) = errno;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
+ php_error_docref(NULL, E_WARNING, "%s", strerror(errno));
RETURN_FALSE;
}
} ZEND_HASH_FOREACH_END();
if (sigprocmask(how, &set, &oldset) != 0) {
PCNTL_G(last_error) = errno;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
+ php_error_docref(NULL, E_WARNING, "%s", strerror(errno));
RETURN_FALSE;
}
@@ -977,18 +977,18 @@ static void pcntl_sigwaitinfo(INTERNAL_FUNCTION_PARAMETERS, int timedwait) /* {{
struct timespec timeout;
if (timedwait) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|z/ll", &user_set, &user_siginfo, &tv_sec, &tv_nsec) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "a|z/ll", &user_set, &user_siginfo, &tv_sec, &tv_nsec) == FAILURE) {
return;
}
} else {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|z/", &user_set, &user_siginfo) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "a|z/", &user_set, &user_siginfo) == FAILURE) {
return;
}
}
if (sigemptyset(&set) != 0) {
PCNTL_G(last_error) = errno;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
+ php_error_docref(NULL, E_WARNING, "%s", strerror(errno));
RETURN_FALSE;
}
@@ -1000,7 +1000,7 @@ static void pcntl_sigwaitinfo(INTERNAL_FUNCTION_PARAMETERS, int timedwait) /* {{
signo = Z_LVAL_P(user_signo);
if (sigaddset(&set, signo) != 0) {
PCNTL_G(last_error) = errno;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
+ php_error_docref(NULL, E_WARNING, "%s", strerror(errno));
RETURN_FALSE;
}
} ZEND_HASH_FOREACH_END();
@@ -1014,7 +1014,7 @@ static void pcntl_sigwaitinfo(INTERNAL_FUNCTION_PARAMETERS, int timedwait) /* {{
}
if (signo == -1 && errno != EAGAIN) {
PCNTL_G(last_error) = errno;
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno));
+ php_error_docref(NULL, E_WARNING, "%s", strerror(errno));
}
/*
@@ -1096,7 +1096,7 @@ PHP_FUNCTION(pcntl_getpriority)
zend_long pid = getpid();
int pri;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll", &pid, &who) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ll", &pid, &who) == FAILURE) {
RETURN_FALSE;
}
@@ -1109,13 +1109,13 @@ PHP_FUNCTION(pcntl_getpriority)
PCNTL_G(last_error) = errno;
switch (errno) {
case ESRCH:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error %d: No process was located using the given parameters", errno);
+ php_error_docref(NULL, E_WARNING, "Error %d: No process was located using the given parameters", errno);
break;
case EINVAL:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error %d: Invalid identifier flag", errno);
+ php_error_docref(NULL, E_WARNING, "Error %d: Invalid identifier flag", errno);
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown error %d has occurred", errno);
+ php_error_docref(NULL, E_WARNING, "Unknown error %d has occurred", errno);
break;
}
RETURN_FALSE;
@@ -1135,7 +1135,7 @@ PHP_FUNCTION(pcntl_setpriority)
zend_long pid = getpid();
zend_long pri;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|ll", &pri, &pid, &who) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|ll", &pri, &pid, &who) == FAILURE) {
RETURN_FALSE;
}
@@ -1143,19 +1143,19 @@ PHP_FUNCTION(pcntl_setpriority)
PCNTL_G(last_error) = errno;
switch (errno) {
case ESRCH:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error %d: No process was located using the given parameters", errno);
+ php_error_docref(NULL, E_WARNING, "Error %d: No process was located using the given parameters", errno);
break;
case EINVAL:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error %d: Invalid identifier flag", errno);
+ php_error_docref(NULL, E_WARNING, "Error %d: Invalid identifier flag", errno);
break;
case EPERM:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error %d: A process was located, but neither its effective nor real user ID matched the effective user ID of the caller", errno);
+ php_error_docref(NULL, E_WARNING, "Error %d: A process was located, but neither its effective nor real user ID matched the effective user ID of the caller", errno);
break;
case EACCES:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error %d: Only a super user may attempt to increase the process priority", errno);
+ php_error_docref(NULL, E_WARNING, "Error %d: Only a super user may attempt to increase the process priority", errno);
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown error %d has occurred", errno);
+ php_error_docref(NULL, E_WARNING, "Unknown error %d has occurred", errno);
break;
}
RETURN_FALSE;
@@ -1180,7 +1180,7 @@ PHP_FUNCTION(pcntl_strerror)
{
zend_long error;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &error) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &error) == FAILURE) {
RETURN_FALSE;
}
@@ -1192,7 +1192,6 @@ PHP_FUNCTION(pcntl_strerror)
static void pcntl_signal_handler(int signo)
{
struct php_pcntl_pending_signal *psig;
- TSRMLS_FETCH();
psig = PCNTL_G(spares);
if (!psig) {
@@ -1221,7 +1220,6 @@ void pcntl_signal_dispatch()
struct php_pcntl_pending_signal *queue, *next;
sigset_t mask;
sigset_t old_mask;
- TSRMLS_FETCH();
if(!PCNTL_G(pending_signals)) {
return;
@@ -1252,7 +1250,7 @@ void pcntl_signal_dispatch()
/* Call php signal handler - Note that we do not report errors, and we ignore the return value */
/* FIXME: this is probably broken when multiple signals are handled in this while loop (retval) */
- call_user_function(EG(function_table), NULL, handle, &retval, 1, &param TSRMLS_CC);
+ call_user_function(EG(function_table), NULL, handle, &retval, 1, &param);
zval_ptr_dtor(&param);
zval_ptr_dtor(&retval);
}