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