svr4_ipc.h revision 43412
151053Smsmith/*
251053Smsmith * Copyright (c) 1998 Mark Newton
351053Smsmith * Copyright (c) 1995 Christos Zoulas.  All rights reserved.
451053Smsmith *
551053Smsmith * Redistribution and use in source and binary forms, with or without
651053Smsmith * modification, are permitted provided that the following conditions
751053Smsmith * are met:
851053Smsmith * 1. Redistributions of source code must retain the above copyright
951053Smsmith *    notice, this list of conditions and the following disclaimer.
1051053Smsmith * 2. Redistributions in binary form must reproduce the above copyright
1151053Smsmith *    notice, this list of conditions and the following disclaimer in the
1251053Smsmith *    documentation and/or other materials provided with the distribution.
1351053Smsmith * 3. All advertising materials mentioning features or use of this software
1451053Smsmith *    must display the following acknowledgement:
1551053Smsmith *	This product includes software developed by Christos Zoulas.
1651053Smsmith * 4. The name of the author may not be used to endorse or promote products
1751053Smsmith *    derived from this software without specific prior written permission.
1851053Smsmith *
1951053Smsmith * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2051053Smsmith * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2151053Smsmith * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2251053Smsmith * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2351053Smsmith * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2451053Smsmith * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2551053Smsmith * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2651053Smsmith * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27124139Sobrien * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28124139Sobrien * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29124139Sobrien */
3051053Smsmith
3184617Sbenno#ifndef _SVR4_IPC_H_
3267227Sobrien#define _SVR4_IPC_H_
3384617Sbenno
3467227Sobrien/*
3567227Sobrien * General IPC
3651053Smsmith */
3751053Smsmith#define	SVR4_IPC_RMID		10
3851053Smsmith#define	SVR4_IPC_SET		11
3951053Smsmith#define	SVR4_IPC_STAT		12
4051053Smsmith
4151053Smsmithstruct svr4_ipc_perm {
4251053Smsmith	svr4_uid_t	uid;
4351053Smsmith	svr4_gid_t	gid;
4451053Smsmith	svr4_uid_t	cuid;
4551053Smsmith	svr4_gid_t	cgid;
4651053Smsmith	svr4_mode_t	mode;
4751053Smsmith	u_long		seq;
4851053Smsmith	svr4_key_t	key;
4951053Smsmith	long		pad[4];
50123376Sgrehan};
5167227Sobrien
5251053Smsmith/*
5367227Sobrien * Message queues
5468548Sbenno */
5551053Smsmith#define SVR4_msgget	0
5651053Smsmith#define SVR4_msgctl	1
5751053Smsmith#define SVR4_msgrcv	2
5851053Smsmith#define SVR4_msgsnd	3
5951053Smsmith
60123376Sgrehanstruct svr4_msg {
6151053Smsmith	struct svr4_msg	*msg_next;
6251053Smsmith	long		msg_type;
63123376Sgrehan	u_short		msg_ts;
6451053Smsmith	short		msg_spot;
6551053Smsmith};
66123376Sgrehan
6759767Sjlemonstruct svr4_msqid_ds {
6859767Sjlemon	struct svr4_ipc_perm msg_perm;
69123376Sgrehan	struct svr4_msg	*msg_first;
7051053Smsmith	struct svr4_msg	*msg_last;
7151053Smsmith	u_long		msg_cbytes;
72123376Sgrehan	u_long		msg_qnum;
73123376Sgrehan	u_long		msg_qbytes;
74123376Sgrehan	svr4_pid_t	msg_lspid;
75123376Sgrehan	svr4_pid_t	msg_lrpid;
76108100Sjake	svr4_time_t	msg_stime;
77123376Sgrehan	long		msg_pad1;
78123376Sgrehan	svr4_time_t	msg_rtime;
79123376Sgrehan	long		msg_pad2;
80123376Sgrehan	svr4_time_t	msg_ctime;
8151053Smsmith	long		msg_pad3;
8251053Smsmith	short		msg_cv;
8351053Smsmith	short		msg_qnum_cv;
8467227Sobrien	long		msg_pad4[3];
85123376Sgrehan};
8668548Sbenno
8767227Sobrienstruct svr4_msgbuf {
8868548Sbenno	long	mtype;		/* message type */
8951053Smsmith	char	mtext[1];	/* message text */
9051053Smsmith};
9167227Sobrien
9251053Smsmithstruct svr4_msginfo {
9351053Smsmith	int	msgmap;
9451053Smsmith	int	msgmax;
9551053Smsmith	int	msgmnb;
9651053Smsmith	int	msgmni;
9759854Sbp	int	msgssz;
9884617Sbenno	int	msgtql;
9951053Smsmith	u_short	msgseg;
10051053Smsmith};
10151053Smsmith
10251053Smsmith/*
10351053Smsmith * Shared memory
10451053Smsmith */
105158467Sjhb#define SVR4_shmat	0
10651053Smsmith#define SVR4_shmctl	1
10751053Smsmith#define SVR4_shmdt	2
10867227Sobrien#define SVR4_shmget	3
10951053Smsmith
11051053Smsmith/* shmctl() operations */
11167227Sobrien#define	SVR4_SHM_LOCK		 3
11251053Smsmith#define	SVR4_SHM_UNLOCK		 4
11351053Smsmith
11484617Sbennostruct svr4_shmid_ds {
11584617Sbenno	struct svr4_ipc_perm	shm_perm;
11684617Sbenno	int		shm_segsz;
11784617Sbenno	void		*shm_amp;
11884617Sbenno	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