sem.h 1014 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 <endian.h>
  24. #include <bits/sem.h>
  25. #define _SEM_SEMUN_UNDEFINED 1
  26. #define SEM_STAT 18
  27. #define SEM_INFO 19
  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. #ifdef __cplusplus
  52. }
  53. #endif
  54. #endif