2 * Copyright 2008-2012 Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
11 #include <sys/types.h>
14 /* Semaphore operation flags */
17 /* Command definition for semctl */
18 #define GETPID 3 /* Get process ID of last element manipulating */
19 #define GETVAL 4 /* Get semval */
20 #define GETALL 5 /* Get all semval */
21 #define GETNCNT 6 /* Get semncnt */
22 #define GETZCNT 7 /* Get semzcnt */
23 #define SETVAL 8 /* Set semval */
24 #define SETALL 9 /* Set all semval */
27 struct ipc_perm sem_perm
; /* Operation permission structure */
28 unsigned short sem_nsems
; /* Number of semaphores in set */
29 time_t sem_otime
; /* Last semop */
30 time_t sem_ctime
; /* Last time changed by semctl */
33 /* Structure passed as parameter to the semop function */
35 unsigned short sem_num
; /* Semaphore number */
36 short sem_op
; /* Semaphore operation */
37 short sem_flg
; /* Operation flags */
41 * Semaphore info structure. Useful for the ipcs
45 int semmni
; /* Number of semaphore identifies */
46 int semmns
; /* Number of semaphore in system */
47 int semmnu
; /* Number of undo structures in system */
48 int semmsl
; /* Max number of semaphores per id */
49 int semopm
; /* Max number of operations per semop call */
50 int semume
; /* Max number of undo entries per process */
51 int semusz
; /* Size in bytes of undo structure */
52 int semvmx
; /* Semaphore maximum valure */
53 int semaem
; /* adjust on exit max value */
59 int semctl(int semID
, int semNum
, int command
, ...);
60 int semget(key_t key
, int numSems
, int semFlags
);
61 int semop(int semID
, struct sembuf
*semOps
, size_t numSemOps
);
65 #endif /* _SYS_SEM_H */