xref: /PHP-7.3/ext/posix/php_posix.h (revision 8d3f8ca1)
1 /*
2    +----------------------------------------------------------------------+
3    | PHP Version 7                                                        |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 1997-2018 The PHP Group                                |
6    +----------------------------------------------------------------------+
7    | This source file is subject to version 3.01 of the PHP license,      |
8    | that is bundled with this package in the file LICENSE, and is        |
9    | available through the world-wide-web at the following url:           |
10    | http://www.php.net/license/3_01.txt                                  |
11    | If you did not receive a copy of the PHP license and are unable to   |
12    | obtain it through the world-wide-web, please send a note to          |
13    | license@php.net so we can mail you a copy immediately.               |
14    +----------------------------------------------------------------------+
15    | Author: Kristian Koehntopp <kris@koehntopp.de>                       |
16    +----------------------------------------------------------------------+
17  */
18 
19 #ifndef PHP_POSIX_H
20 #define PHP_POSIX_H
21 
22 #ifdef HAVE_CONFIG_H
23 #include "config.h"
24 #endif
25 
26 #if HAVE_POSIX
27 #ifndef DLEXPORT
28 #define DLEXPORT
29 #endif
30 
31 extern zend_module_entry posix_module_entry;
32 #define posix_module_ptr &posix_module_entry
33 
34 #include "php_version.h"
35 #define PHP_POSIX_VERSION PHP_VERSION
36 
37 /* POSIX.1, 3.3 */
38 PHP_FUNCTION(posix_kill);
39 
40 /* POSIX.1, 4.1 */
41 PHP_FUNCTION(posix_getpid);
42 PHP_FUNCTION(posix_getppid);
43 
44 /* POSIX.1,  4.2 */
45 PHP_FUNCTION(posix_getuid);
46 PHP_FUNCTION(posix_getgid);
47 PHP_FUNCTION(posix_geteuid);
48 PHP_FUNCTION(posix_getegid);
49 PHP_FUNCTION(posix_setuid);
50 PHP_FUNCTION(posix_setgid);
51 #ifdef HAVE_SETEUID
52 PHP_FUNCTION(posix_seteuid);
53 #endif
54 #ifdef HAVE_SETEGID
55 PHP_FUNCTION(posix_setegid);
56 #endif
57 #ifdef HAVE_GETGROUPS
58 PHP_FUNCTION(posix_getgroups);
59 #endif
60 #ifdef HAVE_GETLOGIN
61 PHP_FUNCTION(posix_getlogin);
62 #endif
63 
64 /* POSIX.1, 4.3 */
65 PHP_FUNCTION(posix_getpgrp);
66 #ifdef HAVE_SETSID
67 PHP_FUNCTION(posix_setsid);
68 #endif
69 PHP_FUNCTION(posix_setpgid);
70 /* Non-Posix functions which are common */
71 #ifdef HAVE_GETPGID
72 PHP_FUNCTION(posix_getpgid);
73 #endif
74 #ifdef HAVE_GETSID
75 PHP_FUNCTION(posix_getsid);
76 #endif
77 
78 /* POSIX.1, 4.4 */
79 PHP_FUNCTION(posix_uname);
80 PHP_FUNCTION(posix_times);
81 
82 /* POSIX.1, 4.5 */
83 #ifdef HAVE_CTERMID
84 PHP_FUNCTION(posix_ctermid);
85 #endif
86 PHP_FUNCTION(posix_ttyname);
87 PHP_FUNCTION(posix_isatty);
88 
89 /* POSIX.1, 5.2 */
90 PHP_FUNCTION(posix_getcwd);
91 
92 /* POSIX.1, 5.4 */
93 #ifdef HAVE_MKFIFO
94 PHP_FUNCTION(posix_mkfifo);
95 #endif
96 #ifdef HAVE_MKNOD
97 PHP_FUNCTION(posix_mknod);
98 #endif
99 
100 /* POSIX.1, 5.6 */
101 PHP_FUNCTION(posix_access);
102 
103 /* POSIX.1, 9.2 */
104 PHP_FUNCTION(posix_getgrnam);
105 PHP_FUNCTION(posix_getgrgid);
106 PHP_FUNCTION(posix_getpwnam);
107 PHP_FUNCTION(posix_getpwuid);
108 
109 #ifdef HAVE_GETRLIMIT
110 PHP_FUNCTION(posix_getrlimit);
111 #endif
112 
113 #ifdef HAVE_SETRLIMIT
114 PHP_FUNCTION(posix_setrlimit);
115 #endif
116 
117 #ifdef HAVE_INITGROUPS
118 PHP_FUNCTION(posix_initgroups);
119 #endif
120 
121 PHP_FUNCTION(posix_get_last_error);
122 PHP_FUNCTION(posix_strerror);
123 
124 ZEND_BEGIN_MODULE_GLOBALS(posix)
125 	int last_error;
126 ZEND_END_MODULE_GLOBALS(posix)
127 
128 #ifdef ZTS
129 # define POSIX_G(v) TSRMG(posix_globals_id, zend_posix_globals *, v)
130 #else
131 # define POSIX_G(v)	(posix_globals.v)
132 #endif
133 
134 #else
135 
136 #define posix_module_ptr NULL
137 
138 #endif
139 
140 #define phpext_posix_ptr posix_module_ptr
141 
142 #endif /* PHP_POSIX_H */
143