1
0

sem.h 1.1 KB

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