php_sysvshm.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. +----------------------------------------------------------------------+
  3. | Copyright (c) The PHP Group |
  4. +----------------------------------------------------------------------+
  5. | This source file is subject to version 3.01 of the PHP license, |
  6. | that is bundled with this package in the file LICENSE, and is |
  7. | available through the world-wide-web at the following url: |
  8. | https://www.php.net/license/3_01.txt |
  9. | If you did not receive a copy of the PHP license and are unable to |
  10. | obtain it through the world-wide-web, please send a note to |
  11. | license@php.net so we can mail you a copy immediately. |
  12. +----------------------------------------------------------------------+
  13. | Author: Christian Cartus <cartus@atrior.de> |
  14. +----------------------------------------------------------------------+
  15. */
  16. #ifndef PHP_SYSVSHM_H
  17. #define PHP_SYSVSHM_H
  18. #ifdef HAVE_SYSVSHM
  19. extern zend_module_entry sysvshm_module_entry;
  20. #define sysvshm_module_ptr &sysvshm_module_entry
  21. #include "php_version.h"
  22. #define PHP_SYSVSHM_VERSION PHP_VERSION
  23. #include <sys/types.h>
  24. #ifdef PHP_WIN32
  25. # include <TSRM/tsrm_win32.h>
  26. # include "win32/ipc.h"
  27. #else
  28. # include <sys/ipc.h>
  29. # include <sys/shm.h>
  30. #endif
  31. typedef struct {
  32. zend_long init_mem;
  33. } sysvshm_module;
  34. typedef struct {
  35. zend_long key;
  36. zend_long length;
  37. zend_long next;
  38. char mem;
  39. } sysvshm_chunk;
  40. typedef struct {
  41. char magic[8];
  42. zend_long start;
  43. zend_long end;
  44. zend_long free;
  45. zend_long total;
  46. } sysvshm_chunk_head;
  47. typedef struct {
  48. key_t key; /* key set by user */
  49. zend_long id; /* returned by shmget */
  50. sysvshm_chunk_head *ptr; /* memory address of shared memory */
  51. zend_object std;
  52. } sysvshm_shm;
  53. PHP_MINIT_FUNCTION(sysvshm);
  54. PHP_MINFO_FUNCTION(sysvshm);
  55. extern sysvshm_module php_sysvshm;
  56. #else
  57. #define sysvshm_module_ptr NULL
  58. #endif
  59. #define phpext_sysvshm_ptr sysvshm_module_ptr
  60. #endif /* PHP_SYSVSHM_H */