1 /* 2 +----------------------------------------------------------------------+ 3 | PHP Version 5 | 4 +----------------------------------------------------------------------+ 5 | Copyright (c) 1997-2016 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 /* 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_INITGROUPS 114 PHP_FUNCTION(posix_initgroups); 115 #endif 116 117 PHP_FUNCTION(posix_get_last_error); 118 PHP_FUNCTION(posix_strerror); 119 120 ZEND_BEGIN_MODULE_GLOBALS(posix) 121 int last_error; 122 ZEND_END_MODULE_GLOBALS(posix) 123 124 #ifdef ZTS 125 # define POSIX_G(v) TSRMG(posix_globals_id, zend_posix_globals *, v) 126 #else 127 # define POSIX_G(v) (posix_globals.v) 128 #endif 129 130 #else 131 132 #define posix_module_ptr NULL 133 134 #endif 135 136 #define phpext_posix_ptr posix_module_ptr 137 138 #endif /* PHP_POSIX_H */ 139