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: Christian Cartus <cartus@atrior.de> |
16 +----------------------------------------------------------------------+
17 */
18
19 /* $Id$ */
20
21 #ifndef PHP_SYSVSHM_H
22 #define PHP_SYSVSHM_H
23
24 #if HAVE_SYSVSHM
25
26 extern zend_module_entry sysvshm_module_entry;
27 #define sysvshm_module_ptr &sysvshm_module_entry
28
29 #include <sys/types.h>
30 #include <sys/ipc.h>
31 #include <sys/shm.h>
32
33 #define PHP_SHM_RSRC_NAME "sysvshm"
34
35 typedef struct {
36 int le_shm;
37 long init_mem;
38 } sysvshm_module;
39
40 typedef struct {
41 long key;
42 long length;
43 long next;
44 char mem;
45 } sysvshm_chunk;
46
47 typedef struct {
48 char magic[8];
49 long start;
50 long end;
51 long free;
52 long total;
53 } sysvshm_chunk_head;
54
55 typedef struct {
56 key_t key; /* key set by user */
57 long id; /* returned by shmget */
58 sysvshm_chunk_head *ptr; /* memory address of shared memory */
59 } sysvshm_shm;
60
61 PHP_MINIT_FUNCTION(sysvshm);
62 PHP_FUNCTION(shm_attach);
63 PHP_FUNCTION(shm_detach);
64 PHP_FUNCTION(shm_remove);
65 PHP_FUNCTION(shm_put_var);
66 PHP_FUNCTION(shm_get_var);
67 PHP_FUNCTION(shm_has_var);
68 PHP_FUNCTION(shm_remove_var);
69
70 extern sysvshm_module php_sysvshm;
71
72 #else
73
74 #define sysvshm_module_ptr NULL
75
76 #endif
77
78 #define phpext_sysvshm_ptr sysvshm_module_ptr
79
80 #endif /* PHP_SYSVSHM_H */