1139743Simp/*-
243412Snewton * Copyright (c) 1998 Mark Newton
343412Snewton * Copyright (c) 1995 Christos Zoulas.  All rights reserved.
443412Snewton *
543412Snewton * Redistribution and use in source and binary forms, with or without
643412Snewton * modification, are permitted provided that the following conditions
743412Snewton * are met:
843412Snewton * 1. Redistributions of source code must retain the above copyright
943412Snewton *    notice, this list of conditions and the following disclaimer.
1043412Snewton * 2. Redistributions in binary form must reproduce the above copyright
1143412Snewton *    notice, this list of conditions and the following disclaimer in the
1243412Snewton *    documentation and/or other materials provided with the distribution.
1343412Snewton * 3. All advertising materials mentioning features or use of this software
1443412Snewton *    must display the following acknowledgement:
1543412Snewton *	This product includes software developed by Christos Zoulas.
1643412Snewton * 4. The name of the author may not be used to endorse or promote products
1743412Snewton *    derived from this software without specific prior written permission.
1843412Snewton *
1943412Snewton * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2043412Snewton * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2143412Snewton * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2243412Snewton * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2343412Snewton * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2443412Snewton * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2543412Snewton * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2643412Snewton * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2743412Snewton * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2843412Snewton * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2949267Snewton *
3050477Speter * $FreeBSD$
3143412Snewton */
3243412Snewton
3343412Snewton#ifndef _SVR4_IPC_H_
3443412Snewton#define _SVR4_IPC_H_
3543412Snewton
3643412Snewton/*
3743412Snewton * General IPC
3843412Snewton */
3943412Snewton#define	SVR4_IPC_RMID		10
4043412Snewton#define	SVR4_IPC_SET		11
4143412Snewton#define	SVR4_IPC_STAT		12
4243412Snewton
4343412Snewtonstruct svr4_ipc_perm {
4443412Snewton	svr4_uid_t	uid;
4543412Snewton	svr4_gid_t	gid;
4643412Snewton	svr4_uid_t	cuid;
4743412Snewton	svr4_gid_t	cgid;
4843412Snewton	svr4_mode_t	mode;
4943412Snewton	u_long		seq;
5043412Snewton	svr4_key_t	key;
5143412Snewton	long		pad[4];
5243412Snewton};
5343412Snewton
5443412Snewton/*
5543412Snewton * Message queues
5643412Snewton */
5743412Snewton#define SVR4_msgget	0
5843412Snewton#define SVR4_msgctl	1
5943412Snewton#define SVR4_msgrcv	2
6043412Snewton#define SVR4_msgsnd	3
6143412Snewton
6243412Snewtonstruct svr4_msg {
6343412Snewton	struct svr4_msg	*msg_next;
6443412Snewton	long		msg_type;
6543412Snewton	u_short		msg_ts;
6643412Snewton	short		msg_spot;
6743412Snewton};
6843412Snewton
6943412Snewtonstruct svr4_msqid_ds {
7043412Snewton	struct svr4_ipc_perm msg_perm;
7143412Snewton	struct svr4_msg	*msg_first;
7243412Snewton	struct svr4_msg	*msg_last;
7343412Snewton	u_long		msg_cbytes;
7443412Snewton	u_long		msg_qnum;
7543412Snewton	u_long		msg_qbytes;
7643412Snewton	svr4_pid_t	msg_lspid;
7743412Snewton	svr4_pid_t	msg_lrpid;
7843412Snewton	svr4_time_t	msg_stime;
7943412Snewton	long		msg_pad1;
8043412Snewton	svr4_time_t	msg_rtime;
8143412Snewton	long		msg_pad2;
8243412Snewton	svr4_time_t	msg_ctime;
8343412Snewton	long		msg_pad3;
8443412Snewton	short		msg_cv;
8543412Snewton	short		msg_qnum_cv;
8643412Snewton	long		msg_pad4[3];
8743412Snewton};
8843412Snewton
8943412Snewtonstruct svr4_msgbuf {
9043412Snewton	long	mtype;		/* message type */
9143412Snewton	char	mtext[1];	/* message text */
9243412Snewton};
9343412Snewton
9443412Snewtonstruct svr4_msginfo {
9543412Snewton	int	msgmap;
9643412Snewton	int	msgmax;
9743412Snewton	int	msgmnb;
9843412Snewton	int	msgmni;
9943412Snewton	int	msgssz;
10043412Snewton	int	msgtql;
10143412Snewton	u_short	msgseg;
10243412Snewton};
10343412Snewton
10443412Snewton/*
10543412Snewton * Shared memory
10643412Snewton */
10743412Snewton#define SVR4_shmat	0
10843412Snewton#define SVR4_shmctl	1
10943412Snewton#define SVR4_shmdt	2
11043412Snewton#define SVR4_shmget	3
11143412Snewton
11243412Snewton/* shmctl() operations */
11343412Snewton#define	SVR4_SHM_LOCK		 3
11443412Snewton#define	SVR4_SHM_UNLOCK		 4
11543412Snewton
11643412Snewtonstruct svr4_shmid_ds {
11743412Snewton	struct svr4_ipc_perm	shm_perm;
11843412Snewton	int		shm_segsz;
11943412Snewton	void		*shm_amp;
12043412Snewton	u_short		shm_lkcnt;
12143412Snewton	svr4_pid_t	shm_lpid;
12243412Snewton	svr4_pid_t	shm_cpid;
12343412Snewton	u_long		shm_nattch;
12443412Snewton	u_long		shm_cnattch;
12543412Snewton	svr4_time_t	shm_atime;
12643412Snewton	long		shm_pad1;
12743412Snewton	svr4_time_t	shm_dtime;
12843412Snewton	long		shm_pad2;
12943412Snewton	svr4_time_t	shm_ctime;
13043412Snewton	long		shm_pad3;
13143412Snewton	long		shm_pad4[4];
13243412Snewton};
13343412Snewton
13443412Snewton/*
13543412Snewton * Semaphores
13643412Snewton */
13743412Snewton#define SVR4_semctl	0
13843412Snewton#define SVR4_semget	1
13943412Snewton#define SVR4_semop	2
14043412Snewton
14143412Snewton/* semctl() operations */
14243412Snewton#define	SVR4_SEM_GETNCNT	 3
14343412Snewton#define	SVR4_SEM_GETPID		 4
14443412Snewton#define	SVR4_SEM_GETVAL		 5
14543412Snewton#define	SVR4_SEM_GETALL		 6
14643412Snewton#define	SVR4_SEM_GETZCNT	 7
14743412Snewton#define	SVR4_SEM_SETVAL		 8
14843412Snewton#define	SVR4_SEM_SETALL		 9
14943412Snewton
15043412Snewtonstruct svr4_sem {
15143412Snewton	u_short		semval;
15243412Snewton	svr4_pid_t	sempid;
15343412Snewton	u_short		semncnt;
15443412Snewton	u_short		semzcnt;
15543412Snewton	u_short		semncnt_cv;
15643412Snewton	u_short		semzcnt_cv;
15743412Snewton};
15843412Snewton
15943412Snewtonstruct svr4_semid_ds {
16043412Snewton	struct svr4_ipc_perm sem_perm;
16143412Snewton	struct svr4_sem	*sem_base;
16243412Snewton	u_short		sem_nsems;
16343412Snewton	svr4_time_t	sem_otime;
16443412Snewton	long		sem_pad1;
16543412Snewton	svr4_time_t	sem_ctime;
16643412Snewton	long		sem_pad2;
16743412Snewton	long		sem_pad3[4];
16843412Snewton};
16943412Snewton
17043412Snewtonstruct svr4_sembuf {
17143412Snewton	u_short		sem_num;
17243412Snewton	short		sem_op;
17343412Snewton	short		sem_flg;
17443412Snewton};
17543412Snewton
17643412Snewton#endif	/* _SVR4_IPC_H */
177