xref: /PHP-8.0/ext/pcntl/php_pcntl.h (revision 24de4274)
1 /*
2    +----------------------------------------------------------------------+
3    | Copyright (c) The PHP Group                                          |
4    +----------------------------------------------------------------------+
5    | This source file is subject to version 3.01 of the PHP license,      |
6    | that is bundled with this package in the file LICENSE, and is        |
7    | available through the world-wide-web at the following url:           |
8    | http://www.php.net/license/3_01.txt                                  |
9    | If you did not receive a copy of the PHP license and are unable to   |
10    | obtain it through the world-wide-web, please send a note to          |
11    | license@php.net so we can mail you a copy immediately.               |
12    +----------------------------------------------------------------------+
13    | Author: Jason Greene <jason@inetgurus.net>                           |
14    +----------------------------------------------------------------------+
15  */
16 
17 #ifndef PHP_PCNTL_H
18 #define PHP_PCNTL_H
19 
20 #if defined(WCONTINUED) && defined(WIFCONTINUED)
21 #define HAVE_WCONTINUED 1
22 #endif
23 
24 extern zend_module_entry pcntl_module_entry;
25 #define phpext_pcntl_ptr &pcntl_module_entry
26 
27 #include "php_version.h"
28 #define PHP_PCNTL_VERSION PHP_VERSION
29 
30 PHP_MINIT_FUNCTION(pcntl);
31 PHP_MSHUTDOWN_FUNCTION(pcntl);
32 PHP_RINIT_FUNCTION(pcntl);
33 PHP_RSHUTDOWN_FUNCTION(pcntl);
34 PHP_MINFO_FUNCTION(pcntl);
35 
36 PHP_FUNCTION(pcntl_alarm);
37 PHP_FUNCTION(pcntl_fork);
38 PHP_FUNCTION(pcntl_waitpid);
39 PHP_FUNCTION(pcntl_wait);
40 PHP_FUNCTION(pcntl_wifexited);
41 PHP_FUNCTION(pcntl_wifstopped);
42 PHP_FUNCTION(pcntl_wifsignaled);
43 #ifdef HAVE_WCONTINUED
44 PHP_FUNCTION(pcntl_wifcontinued);
45 #endif
46 PHP_FUNCTION(pcntl_wexitstatus);
47 PHP_FUNCTION(pcntl_wtermsig);
48 PHP_FUNCTION(pcntl_wstopsig);
49 PHP_FUNCTION(pcntl_signal);
50 PHP_FUNCTION(pcntl_signal_get_handler);
51 PHP_FUNCTION(pcntl_signal_dispatch);
52 PHP_FUNCTION(pcntl_get_last_error);
53 PHP_FUNCTION(pcntl_strerror);
54 #ifdef HAVE_SIGPROCMASK
55 PHP_FUNCTION(pcntl_sigprocmask);
56 #endif
57 #ifdef HAVE_STRUCT_SIGINFO_T
58 # if defined(HAVE_SIGWAITINFO) && defined(HAVE_SIGTIMEDWAIT)
59 PHP_FUNCTION(pcntl_sigwaitinfo);
60 PHP_FUNCTION(pcntl_sigtimedwait);
61 # endif
62 #endif
63 PHP_FUNCTION(pcntl_exec);
64 #ifdef HAVE_GETPRIORITY
65 PHP_FUNCTION(pcntl_getpriority);
66 #endif
67 #ifdef HAVE_SETPRIORITY
68 PHP_FUNCTION(pcntl_setpriority);
69 #endif
70 PHP_FUNCTION(pcntl_async_signals);
71 #ifdef HAVE_UNSHARE
72 PHP_FUNCTION(pcntl_unshare);
73 #endif
74 
75 struct php_pcntl_pending_signal {
76 	struct php_pcntl_pending_signal *next;
77 	zend_long signo;
78 #ifdef HAVE_STRUCT_SIGINFO_T
79 	siginfo_t siginfo;
80 #endif
81 };
82 
83 ZEND_BEGIN_MODULE_GLOBALS(pcntl)
84 	HashTable php_signal_table;
85 	int processing_signal_queue;
86 	struct php_pcntl_pending_signal *head, *tail, *spares;
87 	int last_error;
88 	volatile char pending_signals;
89 	zend_bool async_signals;
90 ZEND_END_MODULE_GLOBALS(pcntl)
91 
92 #if defined(ZTS) && defined(COMPILE_DL_PCNTL)
93 ZEND_TSRMLS_CACHE_EXTERN()
94 #endif
95 
96 ZEND_EXTERN_MODULE_GLOBALS(pcntl)
97 #define PCNTL_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(pcntl, v)
98 
99 #define REGISTER_PCNTL_ERRNO_CONSTANT(name) REGISTER_LONG_CONSTANT("PCNTL_" #name, name, CONST_CS | CONST_PERSISTENT)
100 
101 #endif	/* PHP_PCNTL_H */
102