source: trunk/xc_shm.h @ 979

Last change on this file since 979 was 979, checked in by moo, 2 years ago

closes #2: auto disable on crash

  • Property svn:eol-style set to native
File size: 2.3 KB
RevLine 
[305]1#ifndef XC_SHM_H
2#define XC_SHM_H
[381]3typedef struct _xc_shm_handlers_t xc_shm_handlers_t;
4
5#ifndef XC_SHM_IMPL
6struct _xc_shm_t {
7    const xc_shm_handlers_t *handlers;
[979]8    zend_bool disabled;
[381]9};
10#define XC_SHM_IMPL _xc_shm_t
11#endif
12
13typedef struct XC_SHM_IMPL xc_shm_t;
[11]14typedef size_t xc_shmsize_t;
[1]15
[148]16#include "mem.h"
[1]17
[148]18/* shm */
19#define XC_SHM_CAN_READONLY(func) int   func(xc_shm_t *shm)
20#define XC_SHM_IS_READWRITE(func) int   func(xc_shm_t *shm, const void *p)
21#define XC_SHM_IS_READONLY(func)  int   func(xc_shm_t *shm, const void *p)
22#define XC_SHM_TO_READWRITE(func) void *func(xc_shm_t *shm, void *p)
23#define XC_SHM_TO_READONLY(func)  void *func(xc_shm_t *shm, void *p)
[1]24
[148]25#define XC_SHM_INIT(func)         xc_shm_t *func(xc_shmsize_t size, int readonly_protection, const void *arg1, const void *arg2)
26#define XC_SHM_DESTROY(func)      void func(xc_shm_t *shm)
27
28#define XC_SHM_MEMINIT(func)      xc_mem_t *func(xc_shm_t *shm, xc_memsize_t size)
29#define XC_SHM_MEMDESTROY(func)   void func(xc_mem_t *mem)
30
31#define XC_SHM_HANDLERS(name)    { \
32    NULL                           \
33    , xc_##name##_can_readonly     \
34    , xc_##name##_is_readwrite     \
35    , xc_##name##_is_readonly      \
36    , xc_##name##_to_readwrite     \
37    , xc_##name##_to_readonly      \
38\
39    , xc_##name##_init             \
40    , xc_##name##_destroy          \
41\
42    , xc_##name##_meminit          \
43    , xc_##name##_memdestroy       \
44}
45
[381]46struct _xc_shm_handlers_t {
[148]47    const xc_mem_handlers_t *memhandlers;
48    XC_SHM_CAN_READONLY((*can_readonly));
49    XC_SHM_IS_READWRITE((*is_readwrite));
50    XC_SHM_IS_READONLY((*is_readonly));
51    XC_SHM_TO_READWRITE((*to_readwrite));
52    XC_SHM_TO_READONLY((*to_readonly));
53    XC_SHM_INIT((*init));
54    XC_SHM_DESTROY((*destroy));
55
56    XC_SHM_MEMINIT((*meminit));
57    XC_SHM_MEMDESTROY((*memdestroy));
[381]58};
[148]59
[163]60typedef struct _xc_shm_scheme_t xc_shm_scheme_t;
[148]61
62void xc_shm_init_modules();
63int xc_shm_scheme_register(const char *name, const xc_shm_handlers_t *handlers);
64const xc_shm_handlers_t *xc_shm_scheme_find(const char *name);
[163]65xc_shm_scheme_t *xc_shm_scheme_first();
66xc_shm_scheme_t *xc_shm_scheme_next(xc_shm_scheme_t *scheme);
67const char *xc_shm_scheme_name(xc_shm_scheme_t *scheme);
[148]68
69xc_shm_t *xc_shm_init(const char *type, xc_shmsize_t size, int readonly_protection, const void *arg1, const void *arg2);
[1]70void xc_shm_destroy(xc_shm_t *shm);
[305]71#endif
Note: See TracBrowser for help on using the repository browser.