xref: /PHP-5.5/TSRM/tsrm_win32.h (revision 73c1be26)
1 /*
2    +----------------------------------------------------------------------+
3    | PHP Version 5                                                        |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 1997-2015 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    | Authors: Daniel Beulshausen <daniel@php4win.de>                      |
16    +----------------------------------------------------------------------+
17 */
18 
19 /* $Id$ */
20 
21 #ifndef TSRM_WIN32_H
22 #define TSRM_WIN32_H
23 
24 #include "TSRM.h"
25 #include <windows.h>
26 
27 struct ipc_perm {
28 	int			key;
29 	unsigned short	uid;
30 	unsigned short	gid;
31 	unsigned short	cuid;
32 	unsigned short	cgid;
33 	unsigned short	mode;
34 	unsigned short	seq;
35 };
36 
37 struct shmid_ds {
38 	struct	ipc_perm	shm_perm;
39 	int				shm_segsz;
40 	time_t			shm_atime;
41 	time_t			shm_dtime;
42 	time_t			shm_ctime;
43 	unsigned short	shm_cpid;
44 	unsigned short	shm_lpid;
45 	short			shm_nattch;
46 };
47 
48 typedef struct {
49 	FILE	*stream;
50 	HANDLE	prochnd;
51 } process_pair;
52 
53 typedef struct {
54 	void	*addr;
55 	HANDLE	info;
56 	HANDLE	segment;
57 	struct	shmid_ds	*descriptor;
58 } shm_pair;
59 
60 typedef struct {
61 	process_pair	*process;
62 	shm_pair		*shm;
63 	int				process_size;
64 	int				shm_size;
65 	char			*comspec;
66 	HANDLE impersonation_token;
67 	PSID			impersonation_token_sid;
68 } tsrm_win32_globals;
69 
70 #ifdef ZTS
71 # define TWG(v) TSRMG(win32_globals_id, tsrm_win32_globals *, v)
72 #else
73 # define TWG(v) (win32_globals.v)
74 #endif
75 
76 #define IPC_PRIVATE	0
77 #define IPC_CREAT	00001000
78 #define IPC_EXCL	00002000
79 #define IPC_NOWAIT	00004000
80 
81 #define IPC_RMID	0
82 #define IPC_SET		1
83 #define IPC_STAT	2
84 #define IPC_INFO	3
85 
86 #define SHM_R		PAGE_READONLY
87 #define SHM_W		PAGE_READWRITE
88 
89 #define	SHM_RDONLY	FILE_MAP_READ
90 #define	SHM_RND		FILE_MAP_WRITE
91 #define	SHM_REMAP	FILE_MAP_COPY
92 
93 char * tsrm_win32_get_path_sid_key(const char *pathname  TSRMLS_DC);
94 
95 TSRM_API void tsrm_win32_startup(void);
96 TSRM_API void tsrm_win32_shutdown(void);
97 
98 TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, char *env TSRMLS_DC);
99 TSRM_API FILE *popen(const char *command, const char *type);
100 TSRM_API int pclose(FILE *stream);
101 TSRM_API int tsrm_win32_access(const char *pathname, int mode TSRMLS_DC);
102 TSRM_API int win32_utime(const char *filename, struct utimbuf *buf);
103 
104 TSRM_API int shmget(int key, int size, int flags);
105 TSRM_API void *shmat(int key, const void *shmaddr, int flags);
106 TSRM_API int shmdt(const void *shmaddr);
107 TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf);
108 
109 TSRM_API char *realpath(char *orig_path, char *buffer);
110 #endif
111