]>
Commit | Line | Data |
---|---|---|
f7a9f785 | 1 | /* Copyright (C) 2000-2016 Free Software Foundation, Inc. |
d5efd131 MF |
2 | This file is part of the GNU C Library. |
3 | Contributed by David Mosberger-Tang <davidm@hpl.hp.com> | |
4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | |
6 | modify it under the terms of the GNU Lesser General Public | |
7 | License as published by the Free Software Foundation; either | |
8 | version 2.1 of the License, or (at your option) any later version. | |
9 | ||
10 | The GNU C Library is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | Lesser General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU Lesser General Public | |
75efb018 MF |
16 | License along with the GNU C Library; if not, see |
17 | <http://www.gnu.org/licenses/>. */ | |
d5efd131 MF |
18 | |
19 | #ifndef _SYS_SEM_H | |
20 | # error "Never include <bits/sem.h> directly; use <sys/sem.h> instead." | |
21 | #endif | |
22 | ||
23 | #include <sys/types.h> | |
24 | ||
25 | /* Flags for `semop'. */ | |
26 | #define SEM_UNDO 0x1000 /* undo the operation on exit */ | |
27 | ||
28 | /* Commands for `semctl'. */ | |
29 | #define GETPID 11 /* get sempid */ | |
30 | #define GETVAL 12 /* get semval */ | |
31 | #define GETALL 13 /* get all semval's */ | |
32 | #define GETNCNT 14 /* get semncnt */ | |
33 | #define GETZCNT 15 /* get semzcnt */ | |
34 | #define SETVAL 16 /* set semval */ | |
35 | #define SETALL 17 /* set all semval's */ | |
36 | ||
37 | ||
38 | /* Data structure describing a set of semaphores. */ | |
39 | struct semid_ds | |
40 | { | |
41 | struct ipc_perm sem_perm; /* operation permission struct */ | |
42 | __time_t sem_otime; /* last semop() time */ | |
43 | __time_t sem_ctime; /* last time changed by semctl() */ | |
44 | unsigned long int sem_nsems; /* number of semaphores in set */ | |
d1d9eaf4 OB |
45 | unsigned long int __glibc_reserved1; |
46 | unsigned long int __glibc_reserved2; | |
d5efd131 MF |
47 | }; |
48 | ||
49 | /* The user should define a union like the following to use it for arguments | |
50 | for `semctl'. | |
51 | ||
52 | union semun | |
53 | { | |
54 | int val; <= value for SETVAL | |
55 | struct semid_ds *buf; <= buffer for IPC_STAT & IPC_SET | |
56 | unsigned short int *array; <= array for GETALL & SETALL | |
57 | struct seminfo *__buf; <= buffer for IPC_INFO | |
58 | }; | |
59 | ||
60 | Previous versions of this file used to define this union but this is | |
61 | incorrect. One can test the macro _SEM_SEMUN_UNDEFINED to see whether | |
62 | one must define the union or not. */ | |
63 | #define _SEM_SEMUN_UNDEFINED 1 | |
64 | ||
65 | #ifdef __USE_MISC | |
66 | ||
67 | /* ipcs ctl cmds */ | |
68 | # define SEM_STAT 18 | |
69 | # define SEM_INFO 19 | |
70 | ||
71 | struct seminfo | |
72 | { | |
73 | int semmap; | |
74 | int semmni; | |
75 | int semmns; | |
76 | int semmnu; | |
77 | int semmsl; | |
78 | int semopm; | |
79 | int semume; | |
80 | int semusz; | |
81 | int semvmx; | |
82 | int semaem; | |
83 | }; | |
84 | ||
85 | #endif /* __USE_MISC */ |