xref: /linux/include/uapi/linux/ipc.h (revision 498495dba268b20e8eadd7fe93c140c68b6cc9d2)
1*6f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2607ca46eSDavid Howells #ifndef _UAPI_LINUX_IPC_H
3607ca46eSDavid Howells #define _UAPI_LINUX_IPC_H
4607ca46eSDavid Howells 
5607ca46eSDavid Howells #include <linux/types.h>
6607ca46eSDavid Howells 
7607ca46eSDavid Howells #define IPC_PRIVATE ((__kernel_key_t) 0)
8607ca46eSDavid Howells 
9607ca46eSDavid Howells /* Obsolete, used only for backwards compatibility and libc5 compiles */
10607ca46eSDavid Howells struct ipc_perm
11607ca46eSDavid Howells {
12607ca46eSDavid Howells 	__kernel_key_t	key;
13607ca46eSDavid Howells 	__kernel_uid_t	uid;
14607ca46eSDavid Howells 	__kernel_gid_t	gid;
15607ca46eSDavid Howells 	__kernel_uid_t	cuid;
16607ca46eSDavid Howells 	__kernel_gid_t	cgid;
17607ca46eSDavid Howells 	__kernel_mode_t	mode;
18607ca46eSDavid Howells 	unsigned short	seq;
19607ca46eSDavid Howells };
20607ca46eSDavid Howells 
21607ca46eSDavid Howells /* Include the definition of ipc64_perm */
22607ca46eSDavid Howells #include <asm/ipcbuf.h>
23607ca46eSDavid Howells 
24607ca46eSDavid Howells /* resource get request flags */
25607ca46eSDavid Howells #define IPC_CREAT  00001000   /* create if key is nonexistent */
26607ca46eSDavid Howells #define IPC_EXCL   00002000   /* fail if key exists */
27607ca46eSDavid Howells #define IPC_NOWAIT 00004000   /* return error on wait */
28607ca46eSDavid Howells 
29607ca46eSDavid Howells /* these fields are used by the DIPC package so the kernel as standard
30607ca46eSDavid Howells    should avoid using them if possible */
31607ca46eSDavid Howells 
32607ca46eSDavid Howells #define IPC_DIPC 00010000  /* make it distributed */
33607ca46eSDavid Howells #define IPC_OWN  00020000  /* this machine is the DIPC owner */
34607ca46eSDavid Howells 
35607ca46eSDavid Howells /*
36607ca46eSDavid Howells  * Control commands used with semctl, msgctl and shmctl
37607ca46eSDavid Howells  * see also specific commands in sem.h, msg.h and shm.h
38607ca46eSDavid Howells  */
39607ca46eSDavid Howells #define IPC_RMID 0     /* remove resource */
40607ca46eSDavid Howells #define IPC_SET  1     /* set ipc_perm options */
41607ca46eSDavid Howells #define IPC_STAT 2     /* get ipc_perm options */
42607ca46eSDavid Howells #define IPC_INFO 3     /* see ipcs */
43607ca46eSDavid Howells 
44607ca46eSDavid Howells /*
45607ca46eSDavid Howells  * Version flags for semctl, msgctl, and shmctl commands
46607ca46eSDavid Howells  * These are passed as bitflags or-ed with the actual command
47607ca46eSDavid Howells  */
48607ca46eSDavid Howells #define IPC_OLD 0	/* Old version (no 32-bit UID support on many
49607ca46eSDavid Howells 			   architectures) */
50607ca46eSDavid Howells #define IPC_64  0x0100  /* New version (support 32-bit UIDs, bigger
51607ca46eSDavid Howells 			   message sizes, etc. */
52607ca46eSDavid Howells 
53607ca46eSDavid Howells /*
54607ca46eSDavid Howells  * These are used to wrap system calls.
55607ca46eSDavid Howells  *
56607ca46eSDavid Howells  * See architecture code for ugly details..
57607ca46eSDavid Howells  */
58607ca46eSDavid Howells struct ipc_kludge {
59607ca46eSDavid Howells 	struct msgbuf __user *msgp;
60607ca46eSDavid Howells 	long msgtyp;
61607ca46eSDavid Howells };
62607ca46eSDavid Howells 
63607ca46eSDavid Howells #define SEMOP		 1
64607ca46eSDavid Howells #define SEMGET		 2
65607ca46eSDavid Howells #define SEMCTL		 3
66607ca46eSDavid Howells #define SEMTIMEDOP	 4
67607ca46eSDavid Howells #define MSGSND		11
68607ca46eSDavid Howells #define MSGRCV		12
69607ca46eSDavid Howells #define MSGGET		13
70607ca46eSDavid Howells #define MSGCTL		14
71607ca46eSDavid Howells #define SHMAT		21
72607ca46eSDavid Howells #define SHMDT		22
73607ca46eSDavid Howells #define SHMGET		23
74607ca46eSDavid Howells #define SHMCTL		24
75607ca46eSDavid Howells 
76607ca46eSDavid Howells /* Used by the DIPC package, try and avoid reusing it */
77607ca46eSDavid Howells #define DIPC            25
78607ca46eSDavid Howells 
79607ca46eSDavid Howells #define IPCCALL(version,op)	((version)<<16 | (op))
80607ca46eSDavid Howells 
81607ca46eSDavid Howells 
82607ca46eSDavid Howells #endif /* _UAPI_LINUX_IPC_H */
83