]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - include/uapi/linux/sem.h
scsi: qedf: Fix a potential NULL pointer dereference
[mirror_ubuntu-artful-kernel.git] / include / uapi / linux / sem.h
1 #ifndef _UAPI_LINUX_SEM_H
2 #define _UAPI_LINUX_SEM_H
3
4 #include <linux/ipc.h>
5
6 /* semop flags */
7 #define SEM_UNDO 0x1000 /* undo the operation on exit */
8
9 /* semctl Command Definitions. */
10 #define GETPID 11 /* get sempid */
11 #define GETVAL 12 /* get semval */
12 #define GETALL 13 /* get all semval's */
13 #define GETNCNT 14 /* get semncnt */
14 #define GETZCNT 15 /* get semzcnt */
15 #define SETVAL 16 /* set semval */
16 #define SETALL 17 /* set all semval's */
17
18 /* ipcs ctl cmds */
19 #define SEM_STAT 18
20 #define SEM_INFO 19
21
22 /* Obsolete, used only for backwards compatibility and libc5 compiles */
23 struct semid_ds {
24 struct ipc_perm sem_perm; /* permissions .. see ipc.h */
25 __kernel_time_t sem_otime; /* last semop time */
26 __kernel_time_t sem_ctime; /* last change time */
27 struct sem *sem_base; /* ptr to first semaphore in array */
28 struct sem_queue *sem_pending; /* pending operations to be processed */
29 struct sem_queue **sem_pending_last; /* last pending operation */
30 struct sem_undo *undo; /* undo requests on this array */
31 unsigned short sem_nsems; /* no. of semaphores in array */
32 };
33
34 /* Include the definition of semid64_ds */
35 #include <asm/sembuf.h>
36
37 /* semop system calls takes an array of these. */
38 struct sembuf {
39 unsigned short sem_num; /* semaphore index in array */
40 short sem_op; /* semaphore operation */
41 short sem_flg; /* operation flags */
42 };
43
44 /* arg for semctl system calls. */
45 union semun {
46 int val; /* value for SETVAL */
47 struct semid_ds __user *buf; /* buffer for IPC_STAT & IPC_SET */
48 unsigned short __user *array; /* array for GETALL & SETALL */
49 struct seminfo __user *__buf; /* buffer for IPC_INFO */
50 void __user *__pad;
51 };
52
53 struct seminfo {
54 int semmap;
55 int semmni;
56 int semmns;
57 int semmnu;
58 int semmsl;
59 int semopm;
60 int semume;
61 int semusz;
62 int semvmx;
63 int semaem;
64 };
65
66 /*
67 * SEMMNI, SEMMSL and SEMMNS are default values which can be
68 * modified by sysctl.
69 * The values has been chosen to be larger than necessary for any
70 * known configuration.
71 *
72 * SEMOPM should not be increased beyond 1000, otherwise there is the
73 * risk that semop()/semtimedop() fails due to kernel memory fragmentation when
74 * allocating the sop array.
75 */
76
77
78 #define SEMMNI 32000 /* <= IPCMNI max # of semaphore identifiers */
79 #define SEMMSL 32000 /* <= INT_MAX max num of semaphores per id */
80 #define SEMMNS (SEMMNI*SEMMSL) /* <= INT_MAX max # of semaphores in system */
81 #define SEMOPM 500 /* <= 1 000 max num of ops per semop call */
82 #define SEMVMX 32767 /* <= 32767 semaphore maximum value */
83 #define SEMAEM SEMVMX /* adjust on exit max value */
84
85 /* unused */
86 #define SEMUME SEMOPM /* max num of undo entries per process */
87 #define SEMMNU SEMMNS /* num of undo structures system wide */
88 #define SEMMAP SEMMNS /* # of entries in semaphore map */
89 #define SEMUSZ 20 /* sizeof struct sem_undo */
90
91
92 #endif /* _UAPI_LINUX_SEM_H */