Back to index

php5  5.3.10
Defines | Functions | Variables
pcntl.c File Reference
#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "php_pcntl.h"
#include "php_signal.h"
#include "php_ticks.h"
#include <errno.h>

Go to the source code of this file.

Defines

#define PCNTL_DEBUG   0
#define IF_DEBUG(z)

Functions

static PHP_GINIT_FUNCTION (pcntl)
static void pcntl_signal_handler (int)
static void pcntl_signal_dispatch ()
void php_register_signal_constants (INIT_FUNC_ARGS)
static void php_pcntl_register_errno_constants (INIT_FUNC_ARGS)
 PHP_RINIT_FUNCTION (pcntl)
 PHP_MINIT_FUNCTION (pcntl)
 PHP_MSHUTDOWN_FUNCTION (pcntl)
 PHP_RSHUTDOWN_FUNCTION (pcntl)
 PHP_MINFO_FUNCTION (pcntl)
 PHP_FUNCTION (pcntl_fork)
 PHP_FUNCTION (pcntl_alarm)
 PHP_FUNCTION (pcntl_waitpid)
 PHP_FUNCTION (pcntl_wait)
 PHP_FUNCTION (pcntl_wifexited)
 PHP_FUNCTION (pcntl_wifstopped)
 PHP_FUNCTION (pcntl_wifsignaled)
 PHP_FUNCTION (pcntl_wexitstatus)
 PHP_FUNCTION (pcntl_wtermsig)
 PHP_FUNCTION (pcntl_wstopsig)
 PHP_FUNCTION (pcntl_exec)
 PHP_FUNCTION (pcntl_signal)
 PHP_FUNCTION (pcntl_signal_dispatch)
 PHP_FUNCTION (pcntl_get_last_error)
 PHP_FUNCTION (pcntl_strerror)

Variables

const zend_function_entry pcntl_functions []
zend_module_entry pcntl_module_entry

Define Documentation

#define IF_DEBUG (   z)

Definition at line 27 of file pcntl.c.

#define PCNTL_DEBUG   0

Definition at line 21 of file pcntl.c.


Function Documentation

void pcntl_signal_dispatch ( ) [static]

Definition at line 1223 of file pcntl.c.

{
       zval *param, **handle, *retval;
       struct php_pcntl_pending_signal *queue, *next;
       sigset_t mask;
       sigset_t old_mask;
       TSRMLS_FETCH();
              
       /* Mask all signals */
       sigfillset(&mask);
       sigprocmask(SIG_BLOCK, &mask, &old_mask);

       /* Bail if the queue is empty or if we are already playing the queue*/
       if (! PCNTL_G(head) || PCNTL_G(processing_signal_queue)) {
              sigprocmask(SIG_SETMASK, &old_mask, NULL);
              return;
       }

       /* Prevent reentrant handler calls */
       PCNTL_G(processing_signal_queue) = 1;

       queue = PCNTL_G(head);
       PCNTL_G(head) = NULL; /* simple stores are atomic */
       
       /* Allocate */

       while (queue) {
              if (zend_hash_index_find(&PCNTL_G(php_signal_table), queue->signo, (void **) &handle)==SUCCESS) {
                     MAKE_STD_ZVAL(retval);
                     MAKE_STD_ZVAL(param);
                     ZVAL_NULL(retval);
                     ZVAL_LONG(param, queue->signo);

                     /* 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);
                     zval_ptr_dtor(&param);
                     zval_ptr_dtor(&retval);
              }

              next = queue->next;
              queue->next = PCNTL_G(spares);
              PCNTL_G(spares) = queue;
              queue = next;
       }

       /* Re-enable queue */
       PCNTL_G(processing_signal_queue) = 0;
       
       /* return signal mask to previous state */
       sigprocmask(SIG_SETMASK, &old_mask, NULL);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void pcntl_signal_handler ( int  signo) [static]

Definition at line 1198 of file pcntl.c.

{
       struct php_pcntl_pending_signal *psig;
       TSRMLS_FETCH();
       
       psig = PCNTL_G(spares);
       if (!psig) {
              /* oops, too many signals for us to track, so we'll forget about this one */
              return;
       }
       PCNTL_G(spares) = psig->next;

       psig->signo = signo;
       psig->next = NULL;

       /* the head check is important, as the tick handler cannot atomically clear both
        * the head and tail */
       if (PCNTL_G(head) && PCNTL_G(tail)) {
              PCNTL_G(tail)->next = psig;
       } else {
              PCNTL_G(head) = psig;
       }
       PCNTL_G(tail) = psig;
}

Here is the caller graph for this function:

PHP_FUNCTION ( pcntl_fork  )

Definition at line 541 of file pcntl.c.

{
       pid_t id;

       id = fork();
       if (id == -1) {
              PCNTL_G(last_error) = errno;
              php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error %d", errno);
       }
       
       RETURN_LONG((long) id);
}
PHP_FUNCTION ( pcntl_alarm  )

Definition at line 557 of file pcntl.c.

{
       long seconds;

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &seconds) == FAILURE)
              return;
       
       RETURN_LONG ((long) alarm(seconds));
}

Here is the call graph for this function:

PHP_FUNCTION ( pcntl_waitpid  )

Definition at line 570 of file pcntl.c.

{
       long pid, options = 0;
       zval *z_status = NULL;
       int status;
       pid_t child_id;

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz|l", &pid, &z_status, &options) == FAILURE)
              return;
       
       convert_to_long_ex(&z_status);

       status = Z_LVAL_P(z_status);

       child_id = waitpid((pid_t) pid, &status, options);

       if (child_id < 0) {
              PCNTL_G(last_error) = errno;
       }

       Z_LVAL_P(z_status) = status;

       RETURN_LONG((long) child_id);
}

Here is the call graph for this function:

PHP_FUNCTION ( pcntl_wait  )

Definition at line 598 of file pcntl.c.

{
       long options = 0;
       zval *z_status = NULL;
       int status;
       pid_t child_id;

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &z_status, &options) == FAILURE)
              return;
       
       convert_to_long_ex(&z_status);

       status = Z_LVAL_P(z_status);
#ifdef HAVE_WAIT3
       if(options) {
              child_id = wait3(&status, options, NULL);
       }
       else {
              child_id = wait(&status);
       }
#else
       child_id = wait(&status);
#endif
       if (child_id < 0) {
              PCNTL_G(last_error) = errno;
       }

       Z_LVAL_P(z_status) = status;

       RETURN_LONG((long) child_id);
}

Here is the call graph for this function:

PHP_FUNCTION ( pcntl_wifexited  )

Definition at line 633 of file pcntl.c.

{
#ifdef WIFEXITED
       long status_word;

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) {
              return;
       }

       if (WIFEXITED(status_word))
              RETURN_TRUE;
#endif
       RETURN_FALSE;
}

Here is the call graph for this function:

PHP_FUNCTION ( pcntl_wifstopped  )

Definition at line 651 of file pcntl.c.

{
#ifdef WIFSTOPPED
       long status_word;

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) {
              return;
       }

       if (WIFSTOPPED(status_word))
              RETURN_TRUE;
#endif
       RETURN_FALSE;
}

Here is the call graph for this function:

PHP_FUNCTION ( pcntl_wifsignaled  )

Definition at line 669 of file pcntl.c.

{
#ifdef WIFSIGNALED
       long status_word;

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) {
              return;
       }

       if (WIFSIGNALED(status_word))
              RETURN_TRUE;
#endif
       RETURN_FALSE;
}

Here is the call graph for this function:

PHP_FUNCTION ( pcntl_wexitstatus  )

Definition at line 687 of file pcntl.c.

{
#ifdef WEXITSTATUS
       long status_word;

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) {
              return;
       }

       RETURN_LONG(WEXITSTATUS(status_word));
#else
       RETURN_FALSE;
#endif
}

Here is the call graph for this function:

PHP_FUNCTION ( pcntl_wtermsig  )

Definition at line 705 of file pcntl.c.

{
#ifdef WTERMSIG
       long status_word;

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) {
              return;
       }

       RETURN_LONG(WTERMSIG(status_word));
#else
       RETURN_FALSE;
#endif
}

Here is the call graph for this function:

PHP_FUNCTION ( pcntl_wstopsig  )

Definition at line 723 of file pcntl.c.

{
#ifdef WSTOPSIG
       long status_word;

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &status_word) == FAILURE) {
              return;
       }

       RETURN_LONG(WSTOPSIG(status_word));
#else
       RETURN_FALSE;
#endif
}

Here is the call graph for this function:

PHP_FUNCTION ( pcntl_exec  )

Definition at line 741 of file pcntl.c.

{
       zval *args = NULL, *envs = NULL;
       zval **element;
       HashTable *args_hash, *envs_hash;
       int argc = 0, argi = 0;
       int envc = 0, envi = 0;
       int return_val = 0;
       char **argv = NULL, **envp = NULL;
       char **current_arg, **pair;
       int pair_length;
       char *key;
       uint key_length;
       char *path;
       int path_len;
       ulong key_num;
              
       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|aa", &path, &path_len, &args, &envs) == FAILURE) {
              return;
       }
       
       if (ZEND_NUM_ARGS() > 1) {
              /* Build argumnent list */
              args_hash = HASH_OF(args);
              argc = zend_hash_num_elements(args_hash);
              
              argv = safe_emalloc((argc + 2), sizeof(char *), 0);
              *argv = path;
              for ( zend_hash_internal_pointer_reset(args_hash), current_arg = argv+1; 
                     (argi < argc && (zend_hash_get_current_data(args_hash, (void **) &element) == SUCCESS));
                     (argi++, current_arg++, zend_hash_move_forward(args_hash)) ) {

                     convert_to_string_ex(element);
                     *current_arg = Z_STRVAL_PP(element);
              }
              *(current_arg) = NULL;
       } else {
              argv = emalloc(2 * sizeof(char *));
              *argv = path;
              *(argv+1) = NULL;
       }

       if ( ZEND_NUM_ARGS() == 3 ) {
              /* Build environment pair list */
              envs_hash = HASH_OF(envs);
              envc = zend_hash_num_elements(envs_hash);
              
              envp = safe_emalloc((envc + 1), sizeof(char *), 0);
              for ( zend_hash_internal_pointer_reset(envs_hash), pair = envp; 
                     (envi < envc && (zend_hash_get_current_data(envs_hash, (void **) &element) == SUCCESS));
                     (envi++, pair++, zend_hash_move_forward(envs_hash)) ) {
                     switch (return_val = zend_hash_get_current_key_ex(envs_hash, &key, &key_length, &key_num, 0, NULL)) {
                            case HASH_KEY_IS_LONG:
                                   key = emalloc(101);
                                   snprintf(key, 100, "%ld", key_num);
                                   key_length = strlen(key);
                                   break;
                            case HASH_KEY_NON_EXISTANT:
                                   pair--;
                                   continue;
                     }

                     convert_to_string_ex(element);

                     /* Length of element + equal sign + length of key + null */ 
                     pair_length = Z_STRLEN_PP(element) + key_length + 2;
                     *pair = emalloc(pair_length);
                     strlcpy(*pair, key, key_length); 
                     strlcat(*pair, "=", pair_length);
                     strlcat(*pair, Z_STRVAL_PP(element), pair_length);
                     
                     /* Cleanup */
                     if (return_val == HASH_KEY_IS_LONG) efree(key);
              }
              *(pair) = NULL;

              if (execve(path, argv, envp) == -1) {
                     PCNTL_G(last_error) = errno;
                     php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error has occured: (errno %d) %s", errno, strerror(errno));
              }
       
              /* Cleanup */
              for (pair = envp; *pair != NULL; pair++) efree(*pair);
              efree(envp);
       } else {

              if (execv(path, argv) == -1) {
                     PCNTL_G(last_error) = errno;
                     php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error has occured: (errno %d) %s", errno, strerror(errno));
              }
       }

       efree(argv);
       
       RETURN_FALSE;
}

Here is the call graph for this function:

PHP_FUNCTION ( pcntl_signal  )

Definition at line 841 of file pcntl.c.

{
       zval *handle, **dest_handle = NULL;
       char *func_name;
       long signo;
       zend_bool restart_syscalls = 1;

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz|b", &signo, &handle, &restart_syscalls) == FAILURE) {
              return;
       }

       if (!PCNTL_G(spares)) {
              /* since calling malloc() from within a signal handler is not portable,
               * pre-allocate a few records for recording signals */
              int i;
              for (i = 0; i < 32; i++) {
                     struct php_pcntl_pending_signal *psig;

                     psig = emalloc(sizeof(*psig));
                     psig->next = PCNTL_G(spares);
                     PCNTL_G(spares) = psig;
              }
       }

       /* Special long value case for SIG_DFL and SIG_IGN */
       if (Z_TYPE_P(handle)==IS_LONG) {
              if (Z_LVAL_P(handle)!= (long) SIG_DFL && Z_LVAL_P(handle) != (long) SIG_IGN) {
                     php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid value for handle argument specified");
              }
              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");
                     RETURN_FALSE;
              }
              RETURN_TRUE;
       }
       
       if (!zend_is_callable(handle, 0, &func_name TSRMLS_CC)) {
              PCNTL_G(last_error) = EINVAL;
              php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s is not a callable function name error", func_name);
              efree(func_name);
              RETURN_FALSE;
       }
       efree(func_name);
       
       /* Add the function name to our signal table */
       zend_hash_index_update(&PCNTL_G(php_signal_table), signo, (void **) &handle, sizeof(zval *), (void **) &dest_handle);
       if (dest_handle) zval_add_ref(dest_handle);
       
       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");
              RETURN_FALSE;
       }
       RETURN_TRUE;
}

Here is the call graph for this function:

Definition at line 901 of file pcntl.c.

Here is the call graph for this function:

PHP_FUNCTION ( pcntl_get_last_error  )

Definition at line 1177 of file pcntl.c.

PHP_FUNCTION ( pcntl_strerror  )

Definition at line 1185 of file pcntl.c.

{
        long error;

        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &error) == FAILURE) {
                RETURN_FALSE;
        }

        RETURN_STRING(strerror(error), 1);
}

Here is the call graph for this function:

static PHP_GINIT_FUNCTION ( pcntl  ) [static]

Definition at line 486 of file pcntl.c.

{ 
       memset(pcntl_globals, 0, sizeof(*pcntl_globals));
}
PHP_MINFO_FUNCTION ( pcntl  )

Definition at line 532 of file pcntl.c.

Here is the call graph for this function:

PHP_MINIT_FUNCTION ( pcntl  )

Definition at line 507 of file pcntl.c.

{
       return SUCCESS;
}

Definition at line 419 of file pcntl.c.

{
#ifdef EINTR
       REGISTER_PCNTL_ERRNO_CONSTANT(EINTR);
#endif
#ifdef ECHILD
       REGISTER_PCNTL_ERRNO_CONSTANT(ECHILD);
#endif
#ifdef EINVAL
       REGISTER_PCNTL_ERRNO_CONSTANT(EINVAL);
#endif
#ifdef EAGAIN
       REGISTER_PCNTL_ERRNO_CONSTANT(EAGAIN);
#endif
#ifdef ESRCH
       REGISTER_PCNTL_ERRNO_CONSTANT(ESRCH);
#endif
#ifdef EACCES
       REGISTER_PCNTL_ERRNO_CONSTANT(EACCES);
#endif
#ifdef EPERM
       REGISTER_PCNTL_ERRNO_CONSTANT(EPERM);
#endif
#ifdef ENOMEM
       REGISTER_PCNTL_ERRNO_CONSTANT(ENOMEM);
#endif
#ifdef E2BIG
       REGISTER_PCNTL_ERRNO_CONSTANT(E2BIG);
#endif
#ifdef EFAULT
       REGISTER_PCNTL_ERRNO_CONSTANT(EFAULT);
#endif
#ifdef EIO
       REGISTER_PCNTL_ERRNO_CONSTANT(EIO);
#endif
#ifdef EISDIR
       REGISTER_PCNTL_ERRNO_CONSTANT(EISDIR);
#endif
#ifdef ELIBBAD
       REGISTER_PCNTL_ERRNO_CONSTANT(ELIBBAD);
#endif
#ifdef ELOOP
       REGISTER_PCNTL_ERRNO_CONSTANT(ELOOP);
#endif
#ifdef EMFILE
       REGISTER_PCNTL_ERRNO_CONSTANT(EMFILE);
#endif
#ifdef ENAMETOOLONG
       REGISTER_PCNTL_ERRNO_CONSTANT(ENAMETOOLONG);
#endif
#ifdef ENFILE
       REGISTER_PCNTL_ERRNO_CONSTANT(ENFILE);
#endif
#ifdef ENOENT
       REGISTER_PCNTL_ERRNO_CONSTANT(ENOENT);
#endif
#ifdef ENOEXEC
       REGISTER_PCNTL_ERRNO_CONSTANT(ENOEXEC);
#endif
#ifdef ENOTDIR
       REGISTER_PCNTL_ERRNO_CONSTANT(ENOTDIR);
#endif
#ifdef ETXTBSY
       REGISTER_PCNTL_ERRNO_CONSTANT(ETXTBSY);
#endif
}

Here is the caller graph for this function:

Definition at line 202 of file pcntl.c.

{

       /* Wait Constants */
#ifdef WNOHANG
       REGISTER_LONG_CONSTANT("WNOHANG",  (long) WNOHANG, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef WUNTRACED
       REGISTER_LONG_CONSTANT("WUNTRACED",  (long) WUNTRACED, CONST_CS | CONST_PERSISTENT);
#endif

       /* Signal Constants */
       REGISTER_LONG_CONSTANT("SIG_IGN",  (long) SIG_IGN, CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SIG_DFL",  (long) SIG_DFL, CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SIG_ERR",  (long) SIG_ERR, CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SIGHUP",   (long) SIGHUP,  CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SIGINT",   (long) SIGINT,  CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SIGQUIT",  (long) SIGQUIT, CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SIGILL",   (long) SIGILL,  CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SIGTRAP",  (long) SIGTRAP, CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SIGABRT",  (long) SIGABRT, CONST_CS | CONST_PERSISTENT);
#ifdef SIGIOT
       REGISTER_LONG_CONSTANT("SIGIOT",   (long) SIGIOT,  CONST_CS | CONST_PERSISTENT);
#endif
       REGISTER_LONG_CONSTANT("SIGBUS",   (long) SIGBUS,  CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SIGFPE",   (long) SIGFPE,  CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SIGKILL",  (long) SIGKILL, CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SIGUSR1",  (long) SIGUSR1, CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SIGSEGV",  (long) SIGSEGV, CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SIGUSR2",  (long) SIGUSR2, CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SIGPIPE",  (long) SIGPIPE, CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SIGALRM",  (long) SIGALRM, CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SIGTERM",  (long) SIGTERM, CONST_CS | CONST_PERSISTENT);
#ifdef SIGSTKFLT
       REGISTER_LONG_CONSTANT("SIGSTKFLT",(long) SIGSTKFLT, CONST_CS | CONST_PERSISTENT);
#endif 
#ifdef SIGCLD
       REGISTER_LONG_CONSTANT("SIGCLD",   (long) SIGCLD, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef SIGCHLD
       REGISTER_LONG_CONSTANT("SIGCHLD",  (long) SIGCHLD, CONST_CS | CONST_PERSISTENT);
#endif
       REGISTER_LONG_CONSTANT("SIGCONT",  (long) SIGCONT, CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SIGSTOP",  (long) SIGSTOP, CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SIGTSTP",  (long) SIGTSTP, CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SIGTTIN",  (long) SIGTTIN, CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SIGTTOU",  (long) SIGTTOU, CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SIGURG",   (long) SIGURG , CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SIGXCPU",  (long) SIGXCPU, CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SIGXFSZ",  (long) SIGXFSZ, CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SIGVTALRM",(long) SIGVTALRM, CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SIGPROF",  (long) SIGPROF, CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SIGWINCH", (long) SIGWINCH, CONST_CS | CONST_PERSISTENT);
#ifdef SIGPOLL
       REGISTER_LONG_CONSTANT("SIGPOLL",  (long) SIGPOLL, CONST_CS | CONST_PERSISTENT);
#endif
       REGISTER_LONG_CONSTANT("SIGIO",    (long) SIGIO, CONST_CS | CONST_PERSISTENT);
#ifdef SIGPWR
       REGISTER_LONG_CONSTANT("SIGPWR",   (long) SIGPWR, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef SIGSYS
       REGISTER_LONG_CONSTANT("SIGSYS",   (long) SIGSYS, CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SIGBABY",  (long) SIGSYS, CONST_CS | CONST_PERSISTENT);
#endif

#if HAVE_GETPRIORITY || HAVE_SETPRIORITY
       REGISTER_LONG_CONSTANT("PRIO_PGRP", PRIO_PGRP, CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("PRIO_USER", PRIO_USER, CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("PRIO_PROCESS", PRIO_PROCESS, CONST_CS | CONST_PERSISTENT);
#endif

       /* {{{ "how" argument for sigprocmask */
#ifdef HAVE_SIGPROCMASK
       REGISTER_LONG_CONSTANT("SIG_BLOCK",   SIG_BLOCK, CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SIG_UNBLOCK", SIG_UNBLOCK, CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SIG_SETMASK", SIG_SETMASK, CONST_CS | CONST_PERSISTENT);
#endif
       /* }}} */

       /* {{{ si_code */
#if HAVE_SIGWAITINFO && HAVE_SIGTIMEDWAIT
       REGISTER_LONG_CONSTANT("SI_USER",    SI_USER,    CONST_CS | CONST_PERSISTENT);
#ifdef SI_NOINFO
       REGISTER_LONG_CONSTANT("SI_NOINFO",  SI_NOINFO,  CONST_CS | CONST_PERSISTENT);
#endif
#ifdef SI_KERNEL
       REGISTER_LONG_CONSTANT("SI_KERNEL",  SI_KERNEL,  CONST_CS | CONST_PERSISTENT);
#endif
       REGISTER_LONG_CONSTANT("SI_QUEUE",   SI_QUEUE,   CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SI_TIMER",   SI_TIMER,   CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SI_MESGQ",   SI_MESGQ,   CONST_CS | CONST_PERSISTENT);
       REGISTER_LONG_CONSTANT("SI_ASYNCIO", SI_ASYNCIO, CONST_CS | CONST_PERSISTENT);
#ifdef SI_SIGIO
       REGISTER_LONG_CONSTANT("SI_SIGIO",   SI_SIGIO,   CONST_CS | CONST_PERSISTENT);
#endif
#ifdef SI_TKILL
       REGISTER_LONG_CONSTANT("SI_TKILL",   SI_TKILL,   CONST_CS | CONST_PERSISTENT);
#endif

       /* si_code for SIGCHILD */
#ifdef CLD_EXITED
       REGISTER_LONG_CONSTANT("CLD_EXITED",    CLD_EXITED,    CONST_CS | CONST_PERSISTENT);
#endif
#ifdef CLD_KILLED
       REGISTER_LONG_CONSTANT("CLD_KILLED",    CLD_KILLED,    CONST_CS | CONST_PERSISTENT);
#endif
#ifdef CLD_DUMPED
       REGISTER_LONG_CONSTANT("CLD_DUMPED",    CLD_DUMPED,    CONST_CS | CONST_PERSISTENT);
#endif
#ifdef CLD_TRAPPED
       REGISTER_LONG_CONSTANT("CLD_TRAPPED",   CLD_TRAPPED,   CONST_CS | CONST_PERSISTENT);
#endif
#ifdef CLD_STOPPED
       REGISTER_LONG_CONSTANT("CLD_STOPPED",   CLD_STOPPED,   CONST_CS | CONST_PERSISTENT);
#endif
#ifdef CLD_CONTINUED
       REGISTER_LONG_CONSTANT("CLD_CONTINUED", CLD_CONTINUED, CONST_CS | CONST_PERSISTENT);
#endif

       /* si_code for SIGTRAP */
#ifdef TRAP_BRKPT
       REGISTER_LONG_CONSTANT("TRAP_BRKPT", TRAP_BRKPT, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef TRAP_TRACE
       REGISTER_LONG_CONSTANT("TRAP_TRACE", TRAP_TRACE, CONST_CS | CONST_PERSISTENT);
#endif

       /* si_code for SIGPOLL */
#ifdef POLL_IN
       REGISTER_LONG_CONSTANT("POLL_IN",  POLL_IN,  CONST_CS | CONST_PERSISTENT);
#endif
#ifdef POLL_OUT
       REGISTER_LONG_CONSTANT("POLL_OUT", POLL_OUT, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef POLL_MSG
       REGISTER_LONG_CONSTANT("POLL_MSG", POLL_MSG, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef POLL_ERR
       REGISTER_LONG_CONSTANT("POLL_ERR", POLL_ERR, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef POLL_PRI
       REGISTER_LONG_CONSTANT("POLL_PRI", POLL_PRI, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef POLL_HUP
       REGISTER_LONG_CONSTANT("POLL_HUP", POLL_HUP, CONST_CS | CONST_PERSISTENT);
#endif

#ifdef ILL_ILLOPC
       REGISTER_LONG_CONSTANT("ILL_ILLOPC", ILL_ILLOPC, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ILL_ILLOPN
       REGISTER_LONG_CONSTANT("ILL_ILLOPN", ILL_ILLOPN, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ILL_ILLADR
       REGISTER_LONG_CONSTANT("ILL_ILLADR", ILL_ILLADR, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ILL_ILLTRP
       REGISTER_LONG_CONSTANT("ILL_ILLTRP", ILL_ILLTRP, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ILL_PRVOPC
       REGISTER_LONG_CONSTANT("ILL_PRVOPC", ILL_PRVOPC, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ILL_PRVREG
       REGISTER_LONG_CONSTANT("ILL_PRVREG", ILL_PRVREG, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ILL_COPROC
       REGISTER_LONG_CONSTANT("ILL_COPROC", ILL_COPROC, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef ILL_BADSTK
       REGISTER_LONG_CONSTANT("ILL_BADSTK", ILL_BADSTK, CONST_CS | CONST_PERSISTENT);
#endif

#ifdef FPE_INTDIV
       REGISTER_LONG_CONSTANT("FPE_INTDIV", FPE_INTDIV, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef FPE_INTOVF
       REGISTER_LONG_CONSTANT("FPE_INTOVF", FPE_INTOVF, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef FPE_FLTDIV
       REGISTER_LONG_CONSTANT("FPE_FLTDIV", FPE_FLTDIV, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef FPE_FLTOVF
       REGISTER_LONG_CONSTANT("FPE_FLTOVF", FPE_FLTOVF, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef FPE_FLTUND
       REGISTER_LONG_CONSTANT("FPE_FLTUND", FPE_FLTINV, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef FPE_FLTRES
       REGISTER_LONG_CONSTANT("FPE_FLTRES", FPE_FLTRES, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef FPE_FLTINV
       REGISTER_LONG_CONSTANT("FPE_FLTINV", FPE_FLTINV, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef FPE_FLTSUB
       REGISTER_LONG_CONSTANT("FPE_FLTSUB", FPE_FLTSUB, CONST_CS | CONST_PERSISTENT);
#endif

#ifdef SEGV_MAPERR
       REGISTER_LONG_CONSTANT("SEGV_MAPERR", SEGV_MAPERR, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef SEGV_ACCERR
       REGISTER_LONG_CONSTANT("SEGV_ACCERR", SEGV_ACCERR, CONST_CS | CONST_PERSISTENT);
#endif

#ifdef BUS_ADRALN
       REGISTER_LONG_CONSTANT("BUS_ADRALN", BUS_ADRALN, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef BUS_ADRERR
       REGISTER_LONG_CONSTANT("BUS_ADRERR", BUS_ADRERR, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef BUS_OBJERR
       REGISTER_LONG_CONSTANT("BUS_OBJERR", BUS_OBJERR, CONST_CS | CONST_PERSISTENT);
#endif
#endif /* HAVE_SIGWAITINFO && HAVE_SIGTIMEDWAIT */
       /* }}} */
}

Here is the caller graph for this function:

PHP_RINIT_FUNCTION ( pcntl  )

Definition at line 491 of file pcntl.c.

Definition at line 512 of file pcntl.c.

{
       struct php_pcntl_pending_signal *sig;

       /* FIXME: if a signal is delivered after this point, things will go pear shaped;
        * need to remove signal handlers */
       zend_hash_destroy(&PCNTL_G(php_signal_table));
       while (PCNTL_G(head)) {
              sig = PCNTL_G(head);
              PCNTL_G(head) = sig->next;
              efree(sig);
       }
       while (PCNTL_G(spares)) {
              sig = PCNTL_G(spares);
              PCNTL_G(spares) = sig->next;
              efree(sig);
       }
       return SUCCESS;
}

Here is the call graph for this function:


Variable Documentation

Definition at line 145 of file pcntl.c.

zend_module_entry pcntl_module_entry
Initial value:

Definition at line 178 of file pcntl.c.