Merge from vendor branch FILE:
[dragonfly.git] / sys / emulation / svr4 / svr4_ipc.h
1 /*
2  * Copyright (c) 1998 Mark Newton
3  * Copyright (c) 1995 Christos Zoulas.  All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. All advertising materials mentioning features or use of this software
14  *    must display the following acknowledgement:
15  *      This product includes software developed by Christos Zoulas.
16  * 4. The name of the author may not be used to endorse or promote products
17  *    derived from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  * 
30  * $FreeBSD: src/sys/svr4/svr4_ipc.h,v 1.3 1999/08/28 00:51:18 peter Exp $
31  * $DragonFly: src/sys/emulation/svr4/Attic/svr4_ipc.h,v 1.2 2003/06/17 04:28:57 dillon Exp $
32  */
33
34 #ifndef _SVR4_IPC_H_
35 #define _SVR4_IPC_H_
36
37 /*
38  * General IPC
39  */
40 #define SVR4_IPC_RMID           10
41 #define SVR4_IPC_SET            11
42 #define SVR4_IPC_STAT           12
43
44 struct svr4_ipc_perm {
45         svr4_uid_t      uid;
46         svr4_gid_t      gid;
47         svr4_uid_t      cuid;
48         svr4_gid_t      cgid;
49         svr4_mode_t     mode;
50         u_long          seq;
51         svr4_key_t      key;
52         long            pad[4];
53 };
54
55 /*
56  * Message queues
57  */
58 #define SVR4_msgget     0
59 #define SVR4_msgctl     1
60 #define SVR4_msgrcv     2
61 #define SVR4_msgsnd     3
62
63 struct svr4_msg {
64         struct svr4_msg *msg_next;
65         long            msg_type;
66         u_short         msg_ts; 
67         short           msg_spot;
68 };
69
70 struct svr4_msqid_ds {
71         struct svr4_ipc_perm msg_perm;
72         struct svr4_msg *msg_first;
73         struct svr4_msg *msg_last;
74         u_long          msg_cbytes;
75         u_long          msg_qnum;
76         u_long          msg_qbytes;
77         svr4_pid_t      msg_lspid;
78         svr4_pid_t      msg_lrpid;
79         svr4_time_t     msg_stime;
80         long            msg_pad1;       
81         svr4_time_t     msg_rtime;
82         long            msg_pad2;
83         svr4_time_t     msg_ctime;
84         long            msg_pad3;
85         short           msg_cv;
86         short           msg_qnum_cv;
87         long            msg_pad4[3];
88 };
89
90 struct svr4_msgbuf {
91         long    mtype;          /* message type */
92         char    mtext[1];       /* message text */
93 };
94
95 struct svr4_msginfo {
96         int     msgmap;
97         int     msgmax;
98         int     msgmnb;
99         int     msgmni;
100         int     msgssz;
101         int     msgtql;
102         u_short msgseg;
103 };
104
105 /*
106  * Shared memory
107  */
108 #define SVR4_shmat      0
109 #define SVR4_shmctl     1
110 #define SVR4_shmdt      2
111 #define SVR4_shmget     3
112
113 /* shmctl() operations */
114 #define SVR4_SHM_LOCK            3
115 #define SVR4_SHM_UNLOCK          4
116
117 struct svr4_shmid_ds {
118         struct svr4_ipc_perm    shm_perm;
119         int             shm_segsz;
120         void            *shm_amp;
121         u_short         shm_lkcnt;
122         svr4_pid_t      shm_lpid;
123         svr4_pid_t      shm_cpid;
124         u_long          shm_nattch;
125         u_long          shm_cnattch;
126         svr4_time_t     shm_atime;
127         long            shm_pad1;
128         svr4_time_t     shm_dtime;
129         long            shm_pad2;
130         svr4_time_t     shm_ctime;
131         long            shm_pad3;
132         long            shm_pad4[4];
133 };
134
135 /*
136  * Semaphores
137  */
138 #define SVR4_semctl     0
139 #define SVR4_semget     1
140 #define SVR4_semop      2
141
142 /* semctl() operations */
143 #define SVR4_SEM_GETNCNT         3
144 #define SVR4_SEM_GETPID          4
145 #define SVR4_SEM_GETVAL          5
146 #define SVR4_SEM_GETALL          6
147 #define SVR4_SEM_GETZCNT         7
148 #define SVR4_SEM_SETVAL          8
149 #define SVR4_SEM_SETALL          9
150
151 struct svr4_sem {
152         u_short         semval;
153         svr4_pid_t      sempid;
154         u_short         semncnt;
155         u_short         semzcnt;
156         u_short         semncnt_cv;
157         u_short         semzcnt_cv;
158 };
159
160 struct svr4_semid_ds {
161         struct svr4_ipc_perm sem_perm;
162         struct svr4_sem *sem_base;
163         u_short         sem_nsems;
164         svr4_time_t     sem_otime;
165         long            sem_pad1;
166         svr4_time_t     sem_ctime;
167         long            sem_pad2;
168         long            sem_pad3[4];
169 };
170
171 struct svr4_sembuf {
172         u_short         sem_num;
173         short           sem_op;
174         short           sem_flg;
175 };
176
177 #endif  /* _SVR4_IPC_H */