]>
Commit | Line | Data |
---|---|---|
977bfd77 UD |
1 | /* Copyright (C) 1995, 1996, 1997, 1998 |
2 | Free Software Foundation, Inc. | |
6d52618b | 3 | This file is part of the GNU C Library. |
60478656 | 4 | |
6d52618b UD |
5 | The GNU C Library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public License as | |
7 | published by the Free Software Foundation; either version 2 of the | |
8 | License, or (at your option) any later version. | |
60478656 | 9 | |
6d52618b UD |
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 | Library General Public License for more details. | |
60478656 | 14 | |
6d52618b UD |
15 | You should have received a copy of the GNU Library General Public |
16 | License along with the GNU C Library; see the file COPYING.LIB. If not, | |
17 | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
18 | Boston, MA 02111-1307, USA. */ | |
60478656 | 19 | |
5107cf1d | 20 | #ifndef _SYS_SEM_H |
f4017d20 | 21 | # error "Never include <bits/sem.h> directly; use <sys/sem.h> instead." |
5107cf1d UD |
22 | #endif |
23 | ||
60478656 RM |
24 | #include <sys/types.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 | ||
60478656 RM |
39 | /* Data structure describing a set of semaphores. */ |
40 | struct semid_ds | |
41 | { | |
6d52618b | 42 | struct ipc_perm sem_perm; /* operation permission struct */ |
60478656 RM |
43 | __time_t sem_otime; /* last semop() time */ |
44 | __time_t sem_ctime; /* last time changed by semctl() */ | |
45 | unsigned short int sem_nsems; /* number of semaphores in set */ | |
46 | }; | |
47 | ||
977bfd77 UD |
48 | /* The user should define a union like the following to use it for arguments |
49 | for `semctl'. | |
50 | ||
51 | union semun | |
52 | { | |
53 | int val; <= value for SETVAL | |
54 | struct semid_ds *buf; <= buffer for IPC_STAT & IPC_SET | |
55 | unsigned short int *array; <= array for GETALL & SETALL | |
56 | struct seminfo *__buf; <= buffer for IPC_INFO | |
57 | }; | |
58 | ||
59 | Previous versions of this file used to define this union but this is | |
60 | incorrect. One can test the macro _SEM_SEMUN_UNDEFINED to see whether | |
61 | one must define the union or not. */ | |
62 | #define _SEM_SEMUN_UNDEFINED 1 |