{
pid_t id;
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
id = fork();
if (id == -1) {
PCNTL_G(last_error) = errno;
{
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));
}
/* }}} */
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;
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;
}
/* }}} */
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;
}
/* }}} */
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;
}
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;
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;
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;
Dispatch signals to signal handlers */
PHP_FUNCTION(pcntl_signal_dispatch)
{
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
pcntl_signal_dispatch();
RETURN_TRUE;
}
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 */
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));
}
/* }}} */
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));
}
/* }}} */
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)
{