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 tango.stdc.posix.sys.ipc;
10 
11 private import tango.stdc.posix.config;
12 public import tango.stdc.posix.sys.types; // for uid_t, gid_t, mode_t, key_t
13 private import tango.core.Octal;
14 extern (C):
15 
16 //
17 // XOpen (XSI)
18 //
19 /*
20 struct ipc_perm
21 {
22     uid_t    uid;
23     gid_t    gid;
24     uid_t    cuid;
25     gid_t    cgid;
26     mode_t   mode;
27 }
28 
29 IPC_CREAT
30 IPC_EXCL
31 IPC_NOWAIT
32 
33 IPC_PRIVATE
34 
35 IPC_RMID
36 IPC_SET
37 IPC_STAT
38 
39 key_t ftok(in char*, int);
40 */
41 
42 version( linux )
43 {
44     struct ipc_perm
45     {
46         key_t   __key;
47         uid_t   uid;
48         gid_t   gid;
49         uid_t   cuid;
50         gid_t   cgid;
51         ushort  mode;
52         ushort  __pad1;
53         ushort  __seq;
54         ushort  __pad2;
55         c_ulong __unused1;
56         c_ulong __unused2;
57     }
58 
59     const IPC_CREAT     = octal!1000;
60     const IPC_EXCL      = octal!2000;
61     const IPC_NOWAIT    = octal!4000;
62 
63     const key_t IPC_PRIVATE = 0;
64 
65     const IPC_RMID      = 0;
66     const IPC_SET       = 1;
67     const IPC_STAT      = 2;
68 
69     key_t ftok(in char*, int);
70 }
71 else version( darwin )
72 {
73 
74 }
75 else version( FreeBSD )
76 {
77     struct ipc_perm
78     {
79 		ushort cuid;
80 		ushort cguid;
81 		ushort uid;
82 		ushort gid;
83 		ushort mode;
84 		ushort seq;
85 		key_t key;
86     }
87 
88     const IPC_CREAT     = octal!1000;
89     const IPC_EXCL      = octal!2000;
90     const IPC_NOWAIT    = octal!4000;
91 
92     const key_t IPC_PRIVATE = 0;
93 
94     const IPC_RMID      = 0;
95     const IPC_SET       = 1;
96     const IPC_STAT      = 2;
97 
98     key_t ftok(in char*, int);
99 }
100 else version( solaris )
101 {
102 	struct ipc_perm
103 	{
104 		uid_t		uid;	/* owner's user id */
105 		gid_t		gid;	/* owner's group id */
106 		uid_t		cuid;	/* creator's user id */
107 		gid_t		cgid;	/* creator's group id */
108 		mode_t		mode;	/* access modes */
109 		uint		seq;	/* slot usage sequence number */
110 		key_t		key;	/* key */
111 	  version(X86_64){} else version(X86) {
112 		int[4]		pad; /* reserve area */
113 	  }
114 	}
115 	
116     const IPC_CREAT     = octal!1000;
117     const IPC_EXCL      = octal!2000;
118     const IPC_NOWAIT    = octal!4000;
119 
120     const key_t IPC_PRIVATE = 0;
121 
122     const IPC_RMID      = 10;
123     const IPC_SET       = 11;
124     const IPC_STAT      = 12;
125 
126     key_t ftok(in char*, int);
127 }