xref: /PHP-7.0/ext/posix/php_posix.h (revision 478f119a)
1 /*
2    +----------------------------------------------------------------------+
3    | PHP Version 7                                                        |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 1997-2017 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 
20 /* $Id$ */
21 
22 #ifndef PHP_POSIX_H
23 #define PHP_POSIX_H
24 
25 #ifdef HAVE_CONFIG_H
26 #include "config.h"
27 #endif
28 
29 #if HAVE_POSIX
30 #ifndef DLEXPORT
31 #define DLEXPORT
32 #endif
33 
34 extern zend_module_entry posix_module_entry;
35 #define posix_module_ptr &posix_module_entry
36 
37 #include "php_version.h"
38 #define PHP_POSIX_VERSION PHP_VERSION
39 
40 /* POSIX.1, 3.3 */
41 PHP_FUNCTION(posix_kill);
42 
43 /* POSIX.1, 4.1 */
44 PHP_FUNCTION(posix_getpid);
45 PHP_FUNCTION(posix_getppid);
46 
47 /* POSIX.1,  4.2 */
48 PHP_FUNCTION(posix_getuid);
49 PHP_FUNCTION(posix_getgid);
50 PHP_FUNCTION(posix_geteuid);
51 PHP_FUNCTION(posix_getegid);
52 PHP_FUNCTION(posix_setuid);
53 PHP_FUNCTION(posix_setgid);
54 #ifdef HAVE_SETEUID
55 PHP_FUNCTION(posix_seteuid);
56 #endif
57 #ifdef HAVE_SETEGID
58 PHP_FUNCTION(posix_setegid);
59 #endif
60 #ifdef HAVE_GETGROUPS
61 PHP_FUNCTION(posix_getgroups);
62 #endif
63 #ifdef HAVE_GETLOGIN
64 PHP_FUNCTION(posix_getlogin);
65 #endif
66 
67 /* POSIX.1, 4.3 */
68 PHP_FUNCTION(posix_getpgrp);
69 #ifdef HAVE_SETSID
70 PHP_FUNCTION(posix_setsid);
71 #endif
72 PHP_FUNCTION(posix_setpgid);
73 /* Non-Posix functions which are common */
74 #ifdef HAVE_GETPGID
75 PHP_FUNCTION(posix_getpgid);
76 #endif
77 #ifdef HAVE_GETSID
78 PHP_FUNCTION(posix_getsid);
79 #endif
80 
81 /* POSIX.1, 4.4 */
82 PHP_FUNCTION(posix_uname);
83 PHP_FUNCTION(posix_times);
84 
85 /* POSIX.1, 4.5 */
86 #ifdef HAVE_CTERMID
87 PHP_FUNCTION(posix_ctermid);
88 #endif
89 PHP_FUNCTION(posix_ttyname);
90 PHP_FUNCTION(posix_isatty);
91 
92 /* POSIX.1, 5.2 */
93 PHP_FUNCTION(posix_getcwd);
94 
95 /* POSIX.1, 5.4 */
96 #ifdef HAVE_MKFIFO
97 PHP_FUNCTION(posix_mkfifo);
98 #endif
99 #ifdef HAVE_MKNOD
100 PHP_FUNCTION(posix_mknod);
101 #endif
102 
103 /* POSIX.1, 5.6 */
104 PHP_FUNCTION(posix_access);
105 
106 /* POSIX.1, 9.2 */
107 PHP_FUNCTION(posix_getgrnam);
108 PHP_FUNCTION(posix_getgrgid);
109 PHP_FUNCTION(posix_getpwnam);
110 PHP_FUNCTION(posix_getpwuid);
111 
112 #ifdef HAVE_GETRLIMIT
113 PHP_FUNCTION(posix_getrlimit);
114 #endif
115 
116 #ifdef HAVE_SETRLIMIT
117 PHP_FUNCTION(posix_setrlimit);
118 #endif
119 
120 #ifdef HAVE_INITGROUPS
121 PHP_FUNCTION(posix_initgroups);
122 #endif
123 
124 PHP_FUNCTION(posix_get_last_error);
125 PHP_FUNCTION(posix_strerror);
126 
127 ZEND_BEGIN_MODULE_GLOBALS(posix)
128 	int last_error;
129 ZEND_END_MODULE_GLOBALS(posix)
130 
131 #ifdef ZTS
132 # define POSIX_G(v) TSRMG(posix_globals_id, zend_posix_globals *, v)
133 #else
134 # define POSIX_G(v)	(posix_globals.v)
135 #endif
136 
137 #else
138 
139 #define posix_module_ptr NULL
140 
141 #endif
142 
143 #define phpext_posix_ptr posix_module_ptr
144 
145 #endif /* PHP_POSIX_H */
146