php_sysvshm.h 2.2 KB

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