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