xref: /php-src/ext/standard/proc_open.h (revision 25d6c932)
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    | https://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: Wez Furlong <wez@thebrainroom.com>                           |
14    +----------------------------------------------------------------------+
15  */
16 
17 #ifdef PHP_WIN32
18 typedef HANDLE php_file_descriptor_t;
19 typedef DWORD php_process_id_t;
20 # define PHP_INVALID_FD INVALID_HANDLE_VALUE
21 #else
22 typedef int php_file_descriptor_t;
23 typedef pid_t php_process_id_t;
24 # define PHP_INVALID_FD (-1)
25 #endif
26 
27 /* Environment block under Win32 is a NUL terminated sequence of NUL terminated
28  *   name=value strings.
29  * Under Unix, it is an argv style array. */
30 typedef struct _php_process_env {
31 	char *envp;
32 #ifndef PHP_WIN32
33 	char **envarray;
34 #endif
35 } php_process_env;
36 
37 typedef struct _php_process_handle {
38 	php_process_id_t	child;
39 #ifdef PHP_WIN32
40 	HANDLE childHandle;
41 #endif
42 	int npipes;
43 	zend_resource **pipes;
44 	zend_string *command;
45 	php_process_env env;
46 #if HAVE_SYS_WAIT_H
47 	/* We can only request the status once before it becomes unavailable.
48 	 * Cache the result so we can request it multiple times. */
49 	int cached_exit_wait_status_value;
50 	bool has_cached_exit_wait_status;
51 #endif
52 } php_process_handle;
53