sem.h 3.6 KB

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