164904Smarcel/*-
264904Smarcel * Copyright (c) 2000 Marcel Moolenaar
364904Smarcel * All rights reserved.
464904Smarcel *
564904Smarcel * Redistribution and use in source and binary forms, with or without
664904Smarcel * modification, are permitted provided that the following conditions
764904Smarcel * are met:
864904Smarcel * 1. Redistributions of source code must retain the above copyright
964904Smarcel *    notice, this list of conditions and the following disclaimer
1064904Smarcel *    in this position and unchanged.
1164904Smarcel * 2. Redistributions in binary form must reproduce the above copyright
1264904Smarcel *    notice, this list of conditions and the following disclaimer in the
1364904Smarcel *    documentation and/or other materials provided with the distribution.
1464904Smarcel * 3. The name of the author may not be used to endorse or promote products
1565067Smarcel *    derived from this software without specific prior written permission.
1664904Smarcel *
1764904Smarcel * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1864904Smarcel * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1964904Smarcel * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2064904Smarcel * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2164904Smarcel * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2264904Smarcel * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2364904Smarcel * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2464904Smarcel * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2564904Smarcel * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2664904Smarcel * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2764904Smarcel *
2864904Smarcel * $FreeBSD$
2964904Smarcel */
3064904Smarcel
3164904Smarcel#ifndef _LINUX_IPC_H_
3264904Smarcel#define _LINUX_IPC_H_
3364904Smarcel
34104893Ssobomax/*
35246085Sjhb * SystemV IPC defines
36246085Sjhb */
37246085Sjhb#define	LINUX_SEMOP		1
38246085Sjhb#define	LINUX_SEMGET		2
39246085Sjhb#define	LINUX_SEMCTL		3
40246085Sjhb#define	LINUX_MSGSND		11
41246085Sjhb#define	LINUX_MSGRCV		12
42246085Sjhb#define	LINUX_MSGGET		13
43246085Sjhb#define	LINUX_MSGCTL		14
44246085Sjhb#define	LINUX_SHMAT		21
45246085Sjhb#define	LINUX_SHMDT		22
46246085Sjhb#define	LINUX_SHMGET		23
47246085Sjhb#define	LINUX_SHMCTL		24
48246085Sjhb
49246085Sjhb#define	LINUX_IPC_RMID		0
50246085Sjhb#define	LINUX_IPC_SET		1
51246085Sjhb#define	LINUX_IPC_STAT		2
52246085Sjhb#define	LINUX_IPC_INFO		3
53246085Sjhb
54246085Sjhb#define	LINUX_MSG_INFO	12
55246085Sjhb
56246085Sjhb#define	LINUX_SHM_LOCK		11
57246085Sjhb#define	LINUX_SHM_UNLOCK	12
58246085Sjhb#define	LINUX_SHM_STAT		13
59246085Sjhb#define	LINUX_SHM_INFO		14
60246085Sjhb
61246085Sjhb#define	LINUX_SHM_RDONLY	0x1000
62246085Sjhb#define	LINUX_SHM_RND		0x2000
63246085Sjhb#define	LINUX_SHM_REMAP		0x4000
64246085Sjhb
65246085Sjhb/* semctl commands */
66246085Sjhb#define	LINUX_GETPID		11
67246085Sjhb#define	LINUX_GETVAL		12
68246085Sjhb#define	LINUX_GETALL		13
69246085Sjhb#define	LINUX_GETNCNT		14
70246085Sjhb#define	LINUX_GETZCNT		15
71246085Sjhb#define	LINUX_SETVAL		16
72246085Sjhb#define	LINUX_SETALL		17
73246085Sjhb#define	LINUX_SEM_STAT		18
74246085Sjhb#define	LINUX_SEM_INFO		19
75246085Sjhb
76246085Sjhb/*
77104893Ssobomax * Version flags for semctl, msgctl, and shmctl commands
78104893Ssobomax * These are passed as bitflags or-ed with the actual command
79104893Ssobomax */
80104893Ssobomax#define	LINUX_IPC_OLD	0	/* Old version (no 32-bit UID support on many
81104893Ssobomax				   architectures) */
82104893Ssobomax#define	LINUX_IPC_64	0x0100	/* New version (support 32-bit UIDs, bigger
83104893Ssobomax				   message sizes, etc. */
84104893Ssobomax
85133816Stjr#if defined(__i386__) || defined(__amd64__)
8664904Smarcel
8783221Smarcelstruct linux_msgctl_args
8883221Smarcel{
8983221Smarcel	l_int		msqid;
9083221Smarcel	l_int		cmd;
9183221Smarcel	struct l_msqid_ds *buf;
9283221Smarcel};
9364904Smarcel
9483221Smarcelstruct linux_msgget_args
9583221Smarcel{
9683221Smarcel	l_key_t		key;
9783221Smarcel	l_int		msgflg;
9883221Smarcel};
9964904Smarcel
10083221Smarcelstruct linux_msgrcv_args
10183221Smarcel{
10283221Smarcel	l_int		msqid;
10383221Smarcel	struct l_msgbuf *msgp;
10483221Smarcel	l_size_t	msgsz;
10583221Smarcel	l_long		msgtyp;
10683221Smarcel	l_int		msgflg;
10783221Smarcel};
10868214Sgallatin
10983221Smarcelstruct linux_msgsnd_args
11083221Smarcel{
11183221Smarcel	l_int		msqid;
11283221Smarcel	struct l_msgbuf *msgp;
11383221Smarcel	l_size_t	msgsz;
11483221Smarcel	l_int		msgflg;
11583221Smarcel};
11683221Smarcel
11783221Smarcelstruct linux_semctl_args
11883221Smarcel{
11983221Smarcel	l_int		semid;
12083221Smarcel	l_int		semnum;
12183221Smarcel	l_int		cmd;
12283221Smarcel	union l_semun	arg;
12383221Smarcel};
12483221Smarcel
12583221Smarcelstruct linux_semget_args
12683221Smarcel{
12783221Smarcel	l_key_t		key;
12883221Smarcel	l_int		nsems;
12983221Smarcel	l_int		semflg;
13083221Smarcel};
13183221Smarcel
13283221Smarcelstruct linux_semop_args
13383221Smarcel{
13483221Smarcel	l_int		semid;
13583221Smarcel	struct l_sembuf *tsops;
13683221Smarcel	l_uint		nsops;
13783221Smarcel};
13883221Smarcel
13983221Smarcelstruct linux_shmat_args
14083221Smarcel{
14183221Smarcel	l_int		shmid;
14283221Smarcel	char		*shmaddr;
14383221Smarcel	l_int		shmflg;
14483221Smarcel	l_ulong		*raddr;
14583221Smarcel};
14683221Smarcel
14783221Smarcelstruct linux_shmctl_args
14883221Smarcel{
14983221Smarcel	l_int		shmid;
15083221Smarcel	l_int		cmd;
15183221Smarcel	struct l_shmid_ds *buf;
15283221Smarcel};
15383221Smarcel
15483221Smarcelstruct linux_shmdt_args
15583221Smarcel{
15683221Smarcel	char *shmaddr;
15783221Smarcel};
15883221Smarcel
15983221Smarcelstruct linux_shmget_args
16083221Smarcel{
16183221Smarcel	l_key_t		key;
16283221Smarcel	l_size_t	size;
16383221Smarcel	l_int		shmflg;
16483221Smarcel};
16583221Smarcel
16692761Salfredint linux_msgctl(struct thread *, struct linux_msgctl_args *);
16792761Salfredint linux_msgget(struct thread *, struct linux_msgget_args *);
16892761Salfredint linux_msgrcv(struct thread *, struct linux_msgrcv_args *);
16992761Salfredint linux_msgsnd(struct thread *, struct linux_msgsnd_args *);
17068214Sgallatin
17192761Salfredint linux_semctl(struct thread *, struct linux_semctl_args *);
17292761Salfredint linux_semget(struct thread *, struct linux_semget_args *);
17392761Salfredint linux_semop(struct thread *, struct linux_semop_args *);
17468214Sgallatin
17592761Salfredint linux_shmat(struct thread *, struct linux_shmat_args *);
17692761Salfredint linux_shmctl(struct thread *, struct linux_shmctl_args *);
17792761Salfredint linux_shmdt(struct thread *, struct linux_shmdt_args *);
17892761Salfredint linux_shmget(struct thread *, struct linux_shmget_args *);
17968214Sgallatin
180133816Stjr#endif	/* __i386__ || __amd64__ */
18183221Smarcel
18264904Smarcel#endif /* _LINUX_IPC_H_ */
183