xref: /freebsd-11-stable/sys/compat/svr4/svr4_ipc.h (revision 898b0535b73b62baaf1d386b169e4d215194a012)
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$
31  */
32 
33 #ifndef _SVR4_IPC_H_
34 #define _SVR4_IPC_H_
35 
36 /*
37  * General IPC
38  */
39 #define	SVR4_IPC_RMID		10
40 #define	SVR4_IPC_SET		11
41 #define	SVR4_IPC_STAT		12
42 
43 struct svr4_ipc_perm {
44 	svr4_uid_t	uid;
45 	svr4_gid_t	gid;
46 	svr4_uid_t	cuid;
47 	svr4_gid_t	cgid;
48 	svr4_mode_t	mode;
49 	u_long		seq;
50 	svr4_key_t	key;
51 	long		pad[4];
52 };
53 
54 /*
55  * Message queues
56  */
57 #define SVR4_msgget	0
58 #define SVR4_msgctl	1
59 #define SVR4_msgrcv	2
60 #define SVR4_msgsnd	3
61 
62 struct svr4_msg {
63 	struct svr4_msg	*msg_next;
64 	long		msg_type;
65 	u_short		msg_ts;
66 	short		msg_spot;
67 };
68 
69 struct svr4_msqid_ds {
70 	struct svr4_ipc_perm msg_perm;
71 	struct svr4_msg	*msg_first;
72 	struct svr4_msg	*msg_last;
73 	u_long		msg_cbytes;
74 	u_long		msg_qnum;
75 	u_long		msg_qbytes;
76 	svr4_pid_t	msg_lspid;
77 	svr4_pid_t	msg_lrpid;
78 	svr4_time_t	msg_stime;
79 	long		msg_pad1;
80 	svr4_time_t	msg_rtime;
81 	long		msg_pad2;
82 	svr4_time_t	msg_ctime;
83 	long		msg_pad3;
84 	short		msg_cv;
85 	short		msg_qnum_cv;
86 	long		msg_pad4[3];
87 };
88 
89 struct svr4_msgbuf {
90 	long	mtype;		/* message type */
91 	char	mtext[1];	/* message text */
92 };
93 
94 struct svr4_msginfo {
95 	int	msgmap;
96 	int	msgmax;
97 	int	msgmnb;
98 	int	msgmni;
99 	int	msgssz;
100 	int	msgtql;
101 	u_short	msgseg;
102 };
103 
104 /*
105  * Shared memory
106  */
107 #define SVR4_shmat	0
108 #define SVR4_shmctl	1
109 #define SVR4_shmdt	2
110 #define SVR4_shmget	3
111 
112 /* shmctl() operations */
113 #define	SVR4_SHM_LOCK		 3
114 #define	SVR4_SHM_UNLOCK		 4
115 
116 struct svr4_shmid_ds {
117 	struct svr4_ipc_perm	shm_perm;
118 	int		shm_segsz;
119 	void		*shm_amp;
120 	u_short		shm_lkcnt;
121 	svr4_pid_t	shm_lpid;
122 	svr4_pid_t	shm_cpid;
123 	u_long		shm_nattch;
124 	u_long		shm_cnattch;
125 	svr4_time_t	shm_atime;
126 	long		shm_pad1;
127 	svr4_time_t	shm_dtime;
128 	long		shm_pad2;
129 	svr4_time_t	shm_ctime;
130 	long		shm_pad3;
131 	long		shm_pad4[4];
132 };
133 
134 /*
135  * Semaphores
136  */
137 #define SVR4_semctl	0
138 #define SVR4_semget	1
139 #define SVR4_semop	2
140 
141 /* semctl() operations */
142 #define	SVR4_SEM_GETNCNT	 3
143 #define	SVR4_SEM_GETPID		 4
144 #define	SVR4_SEM_GETVAL		 5
145 #define	SVR4_SEM_GETALL		 6
146 #define	SVR4_SEM_GETZCNT	 7
147 #define	SVR4_SEM_SETVAL		 8
148 #define	SVR4_SEM_SETALL		 9
149 
150 struct svr4_sem {
151 	u_short		semval;
152 	svr4_pid_t	sempid;
153 	u_short		semncnt;
154 	u_short		semzcnt;
155 	u_short		semncnt_cv;
156 	u_short		semzcnt_cv;
157 };
158 
159 struct svr4_semid_ds {
160 	struct svr4_ipc_perm sem_perm;
161 	struct svr4_sem	*sem_base;
162 	u_short		sem_nsems;
163 	svr4_time_t	sem_otime;
164 	long		sem_pad1;
165 	svr4_time_t	sem_ctime;
166 	long		sem_pad2;
167 	long		sem_pad3[4];
168 };
169 
170 struct svr4_sembuf {
171 	u_short		sem_num;
172 	short		sem_op;
173 	short		sem_flg;
174 };
175 
176 #endif	/* _SVR4_IPC_H */
177