/src/core/sys/posix/sys/shm.d

http://github.com/AlexeyProkhin/druntime · D · 126 lines · 71 code · 14 blank · 41 comment · 2 complexity · 7f714732154d6dcd3fbaa43caa584035 MD5 · raw file

  1. /**
  2. * D header file for POSIX.
  3. *
  4. * Copyright: Copyright Sean Kelly 2005 - 2009.
  5. * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
  6. * Authors: Sean Kelly
  7. * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition
  8. */
  9. /* Copyright Sean Kelly 2005 - 2009.
  10. * Distributed under the Boost Software License, Version 1.0.
  11. * (See accompanying file LICENSE or copy at
  12. * http://www.boost.org/LICENSE_1_0.txt)
  13. */
  14. module core.sys.posix.sys.shm;
  15. private import core.sys.posix.config;
  16. public import core.sys.posix.sys.types; // for pid_t, time_t, key_t, size_t
  17. public import core.sys.posix.sys.ipc;
  18. version (Posix):
  19. extern (C):
  20. //
  21. // XOpen (XSI)
  22. //
  23. /*
  24. SHM_RDONLY
  25. SHM_RND
  26. SHMLBA
  27. shmatt_t
  28. struct shmid_ds
  29. {
  30. ipc_perm shm_perm;
  31. size_t shm_segsz;
  32. pid_t shm_lpid;
  33. pid_t shm_cpid;
  34. shmatt_t shm_nattch;
  35. time_t shm_atime;
  36. time_t shm_dtime;
  37. time_t shm_ctime;
  38. }
  39. void* shmat(int, in void*, int);
  40. int shmctl(int, int, shmid_ds*);
  41. int shmdt(in void*);
  42. int shmget(key_t, size_t, int);
  43. */
  44. version( linux )
  45. {
  46. enum SHM_RDONLY = 0x01000; // 010000
  47. enum SHM_RND = 0x02000; // 020000
  48. int __getpagesize();
  49. alias __getpagesize SHMLBA;
  50. alias c_ulong shmatt_t;
  51. struct shmid_ds
  52. {
  53. ipc_perm shm_perm;
  54. size_t shm_segsz;
  55. time_t shm_atime;
  56. c_ulong __unused1;
  57. time_t shm_dtime;
  58. c_ulong __unused2;
  59. time_t shm_ctime;
  60. c_ulong __unused3;
  61. pid_t shm_cpid;
  62. pid_t shm_lpid;
  63. shmatt_t shm_nattch;
  64. c_ulong __unused4;
  65. c_ulong __unused5;
  66. }
  67. void* shmat(int, in void*, int);
  68. int shmctl(int, int, shmid_ds*);
  69. int shmdt(in void*);
  70. int shmget(key_t, size_t, int);
  71. }
  72. else version( FreeBSD )
  73. {
  74. enum SHM_RDONLY = 0x01000; // 010000
  75. enum SHM_RND = 0x02000; // 020000
  76. enum SHMLBA = 1 << 12; // PAGE_SIZE = (1<<PAGE_SHIFT)
  77. alias c_ulong shmatt_t;
  78. struct shmid_ds_old // <= FreeBSD7
  79. {
  80. ipc_perm_old shm_perm;
  81. int shm_segsz;
  82. pid_t shm_lpid;
  83. pid_t shm_cpid;
  84. short shm_nattch;
  85. time_t shm_atime;
  86. time_t shm_dtime;
  87. time_t shm_ctime;
  88. void* shm_internal;
  89. }
  90. struct shmid_ds
  91. {
  92. ipc_perm shm_perm;
  93. int shm_segsz;
  94. pid_t shm_lpid;
  95. pid_t shm_cpid;
  96. short shm_nattch;
  97. time_t shm_atime;
  98. time_t shm_dtime;
  99. time_t shm_ctime;
  100. }
  101. void* shmat(int, in void*, int);
  102. int shmctl(int, int, shmid_ds*);
  103. int shmdt(in void*);
  104. int shmget(key_t, size_t, int);
  105. }
  106. else version( OSX )
  107. {
  108. }