]>
Commit | Line | Data |
---|---|---|
688903eb | 1 | /* Copyright (C) 2011-2018 Free Software Foundation, Inc. |
a63c7fa1 CM |
2 | This file is part of the GNU C Library. |
3 | Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011. | |
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 | |
ab84e3ff PE |
16 | License along with the GNU C Library. If not, see |
17 | <http://www.gnu.org/licenses/>. */ | |
a63c7fa1 CM |
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 | #include <bits/wordsize.h> | |
25 | ||
26 | /* Flags for `semop'. */ | |
27 | #define SEM_UNDO 0x1000 /* undo the operation on exit */ | |
28 | ||
29 | /* Commands for `semctl'. */ | |
30 | #define GETPID 11 /* get sempid */ | |
31 | #define GETVAL 12 /* get semval */ | |
32 | #define GETALL 13 /* get all semval's */ | |
33 | #define GETNCNT 14 /* get semncnt */ | |
34 | #define GETZCNT 15 /* get semzcnt */ | |
35 | #define SETVAL 16 /* set semval */ | |
36 | #define SETALL 17 /* set all semval's */ | |
37 | ||
38 | ||
39 | /* Data structure describing a set of semaphores. */ | |
40 | struct semid_ds | |
41 | { | |
42 | struct ipc_perm sem_perm; /* operation permission struct */ | |
43 | __time_t sem_otime; /* last semop() time */ | |
44 | #if __WORDSIZE == 32 | |
d1d9eaf4 | 45 | unsigned long int __glibc_reserved1; |
a63c7fa1 CM |
46 | #endif |
47 | __time_t sem_ctime; /* last time changed by semctl() */ | |
48 | #if __WORDSIZE == 32 | |
d1d9eaf4 | 49 | unsigned long int __glibc_reserved2; |
a63c7fa1 CM |
50 | #endif |
51 | unsigned long int sem_nsems; /* number of semaphores in set */ | |
d1d9eaf4 OB |
52 | unsigned long int __glibc_reserved3; |
53 | unsigned long int __glibc_reserved4; | |
a63c7fa1 CM |
54 | }; |
55 | ||
56 | /* The user should define a union like the following to use it for arguments | |
57 | for `semctl'. | |
58 | ||
59 | union semun | |
60 | { | |
61 | int val; <= value for SETVAL | |
62 | struct semid_ds *buf; <= buffer for IPC_STAT & IPC_SET | |
63 | unsigned short int *array; <= array for GETALL & SETALL | |
64 | struct seminfo *__buf; <= buffer for IPC_INFO | |
65 | }; | |
66 | ||
67 | Previous versions of this file used to define this union but this is | |
68 | incorrect. One can test the macro _SEM_SEMUN_UNDEFINED to see whether | |
69 | one must define the union or not. */ | |
70 | #define _SEM_SEMUN_UNDEFINED 1 | |
71 | ||
72 | #ifdef __USE_MISC | |
73 | ||
74 | /* ipcs ctl cmds */ | |
75 | # define SEM_STAT 18 | |
76 | # define SEM_INFO 19 | |
77 | ||
78 | struct seminfo | |
79 | { | |
80 | int semmap; | |
81 | int semmni; | |
82 | int semmns; | |
83 | int semmnu; | |
84 | int semmsl; | |
85 | int semopm; | |
86 | int semume; | |
87 | int semusz; | |
88 | int semvmx; | |
89 | int semaem; | |
90 | }; | |
91 | ||
92 | #endif /* __USE_MISC */ |