]> git.llucax.com Git - software/druntime.git/blob - import/stdc/posix/sys/shm.d
First commit of the D Runtime Project. This includes a fully functional runtime...
[software/druntime.git] / import / stdc / posix / sys / shm.d
1 /**
2  * D header file for POSIX.
3  *
4  * Copyright: Public Domain
5  * License:   Public Domain
6  * Authors:   Sean Kelly
7  * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition
8  */
9 module stdc.posix.sys.shm;
10
11 private import stdc.posix.config;
12 public import stdc.posix.sys.types; // for pid_t, time_t, key_t, size_t
13 public import stdc.posix.sys.ipc;
14
15 extern (C):
16
17 //
18 // XOpen (XSI)
19 //
20 /*
21 SHM_RDONLY
22 SHM_RND
23
24 SHMLBA
25
26 shmatt_t
27
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
40 void* shmat(int, in void*, int);
41 int   shmctl(int, int, shmid_ds*);
42 int   shmdt(in void*);
43 int   shmget(key_t, size_t, int);
44 */
45
46 version( linux )
47 {
48     const SHM_RDONLY    = 010000;
49     const SHM_RND       = 020000;
50
51     int   __getpagesize();
52     alias __getpagesize SHMLBA;
53
54     alias c_ulong   shmatt_t;
55
56     struct shmid_ds
57     {
58         ipc_perm    shm_perm;
59         size_t      shm_segsz;
60         time_t      shm_atime;
61         c_ulong     __unused1;
62         time_t      shm_dtime;
63         c_ulong     __unused2;
64         time_t      shm_ctime;
65         c_ulong     __unused3;
66         pid_t       shm_cpid;
67         pid_t       shm_lpid;
68         shmatt_t    shm_nattch;
69         c_ulong     __unused4;
70         c_ulong     __unused5;
71     }
72
73     void* shmat(int, in void*, int);
74     int   shmctl(int, int, shmid_ds*);
75     int   shmdt(in void*);
76     int   shmget(key_t, size_t, int);
77 }
78 else version( freebsd )
79 {
80     const SHM_RDONLY    = 010000;
81     const SHM_RND       = 020000;
82     const SHMLBA        = 1 << 12; // PAGE_SIZE = (1<<PAGE_SHIFT)
83
84     alias c_ulong   shmatt_t;
85
86     struct shmid_ds
87     {
88         ipc_perm    shm_perm;
89         size_t      shm_segsz;
90         time_t      shm_atime;
91         c_ulong     __unused1;
92         time_t      shm_dtime;
93         c_ulong     __unused2;
94         time_t      shm_ctime;
95         c_ulong     __unused3;
96         pid_t       shm_cpid;
97         pid_t       shm_lpid;
98         shmatt_t    shm_nattch;
99         c_ulong     __unused4;
100         c_ulong     __unused5;
101     }
102
103     void* shmat(int, in void*, int);
104     int   shmctl(int, int, shmid_ds*);
105     int   shmdt(in void*);
106     int   shmget(key_t, size_t, int);
107 }
108 else version( darwin )
109 {
110
111 }