XCache is a fast, stable PHP opcode cacher that has been proven and is now running on production servers under high load. https://xcache.lighttpd.net/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.9 KiB

  1. typedef struct _xc_shm_t xc_shm_t;
  2. typedef size_t xc_shmsize_t;
  3. #include "mem.h"
  4. /* shm */
  5. #define XC_SHM_CAN_READONLY(func) int func(xc_shm_t *shm)
  6. #define XC_SHM_IS_READWRITE(func) int func(xc_shm_t *shm, const void *p)
  7. #define XC_SHM_IS_READONLY(func) int func(xc_shm_t *shm, const void *p)
  8. #define XC_SHM_TO_READWRITE(func) void *func(xc_shm_t *shm, void *p)
  9. #define XC_SHM_TO_READONLY(func) void *func(xc_shm_t *shm, void *p)
  10. #define XC_SHM_INIT(func) xc_shm_t *func(xc_shmsize_t size, int readonly_protection, const void *arg1, const void *arg2)
  11. #define XC_SHM_DESTROY(func) void func(xc_shm_t *shm)
  12. #define XC_SHM_MEMINIT(func) xc_mem_t *func(xc_shm_t *shm, xc_memsize_t size)
  13. #define XC_SHM_MEMDESTROY(func) void func(xc_mem_t *mem)
  14. #define XC_SHM_HANDLERS(name) { \
  15. NULL \
  16. , xc_##name##_can_readonly \
  17. , xc_##name##_is_readwrite \
  18. , xc_##name##_is_readonly \
  19. , xc_##name##_to_readwrite \
  20. , xc_##name##_to_readonly \
  21. \
  22. , xc_##name##_init \
  23. , xc_##name##_destroy \
  24. \
  25. , xc_##name##_meminit \
  26. , xc_##name##_memdestroy \
  27. }
  28. typedef struct {
  29. const xc_mem_handlers_t *memhandlers;
  30. XC_SHM_CAN_READONLY((*can_readonly));
  31. XC_SHM_IS_READWRITE((*is_readwrite));
  32. XC_SHM_IS_READONLY((*is_readonly));
  33. XC_SHM_TO_READWRITE((*to_readwrite));
  34. XC_SHM_TO_READONLY((*to_readonly));
  35. XC_SHM_INIT((*init));
  36. XC_SHM_DESTROY((*destroy));
  37. XC_SHM_MEMINIT((*meminit));
  38. XC_SHM_MEMDESTROY((*memdestroy));
  39. } xc_shm_handlers_t;
  40. #ifndef XC_SHM_IMPL
  41. struct _xc_shm_t {
  42. const xc_shm_handlers_t *handlers;
  43. };
  44. #endif
  45. void xc_shm_init_modules();
  46. int xc_shm_scheme_register(const char *name, const xc_shm_handlers_t *handlers);
  47. const xc_shm_handlers_t *xc_shm_scheme_find(const char *name);
  48. xc_shm_t *xc_shm_init(const char *type, xc_shmsize_t size, int readonly_protection, const void *arg1, const void *arg2);
  49. void xc_shm_destroy(xc_shm_t *shm);