1 #ifndef _SYS_SEM_H 2 #define _SYS_SEM_H 3 #ifdef __cplusplus 4 extern "C" { 5 #endif 6 7 #include <features.h> 8 9 #define __NEED_size_t 10 #define __NEED_pid_t 11 #define __NEED_time_t 12 #ifdef _GNU_SOURCE 13 #define __NEED_struct_timespec 14 #endif 15 #include <bits/alltypes.h> 16 17 #include <sys/ipc.h> 18 19 #define SEM_UNDO 0x1000 20 #define GETPID 11 21 #define GETVAL 12 22 #define GETALL 13 23 #define GETNCNT 14 24 #define GETZCNT 15 25 #define SETVAL 16 26 #define SETALL 17 27 28 #include <bits/sem.h> 29 30 #define _SEM_SEMUN_UNDEFINED 1 31 32 #define SEM_STAT (18 | (IPC_STAT & 0x100)) 33 #define SEM_INFO 19 34 #define SEM_STAT_ANY (20 | (IPC_STAT & 0x100)) 35 36 struct seminfo { 37 int semmap; 38 int semmni; 39 int semmns; 40 int semmnu; 41 int semmsl; 42 int semopm; 43 int semume; 44 int semusz; 45 int semvmx; 46 int semaem; 47 }; 48 49 struct sembuf { 50 unsigned short sem_num; 51 short sem_op; 52 short sem_flg; 53 }; 54 55 int semctl(int, int, int, ...); 56 int semget(key_t, int, int); 57 int semop(int, struct sembuf *, size_t); 58 59 #ifdef _GNU_SOURCE 60 int semtimedop(int, struct sembuf *, size_t, const struct timespec *); 61 #endif 62 63 #if _REDIR_TIME64 64 #ifdef _GNU_SOURCE 65 __REDIR(semtimedop, __semtimedop_time64); 66 #endif 67 #endif 68 69 #ifdef __cplusplus 70 } 71 #endif 72 #endif 73