sem.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* Copyright (C) 1995, 1996, 1997, 1998, 2000, 2002
  2. Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <http://www.gnu.org/licenses/>. */
  15. #ifndef _SYS_SEM_H
  16. # error "Never include <bits/sem.h> directly; use <sys/sem.h> instead."
  17. #endif
  18. #include <sys/types.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 __WORDSIZE == 32
  34. unsigned int __uclibc_unused1;
  35. #endif
  36. #if defined(__UCLIBC_USE_TIME64__)
  37. unsigned long int __sem_otime_internal_1; /* last semop() time */
  38. unsigned long int __sem_otime_internal_2;
  39. #else
  40. __time_t sem_otime; /* last semop() time */
  41. #endif
  42. #if __WORDSIZE == 32
  43. unsigned int __uclibc_unused2;
  44. #endif
  45. #if defined(__UCLIBC_USE_TIME64__)
  46. unsigned long int __sem_ctime_internal_1; /* last time changed by semctl() */
  47. unsigned long int __sem_ctime_internal_2;
  48. #else
  49. __time_t sem_ctime; /* last time changed by semctl() */
  50. #endif
  51. unsigned long int sem_nsems; /* number of semaphores in set */
  52. #if defined(__UCLIBC_USE_TIME64__)
  53. __time_t sem_otime;
  54. __time_t sem_ctime;
  55. #endif
  56. unsigned long __uclibc_unused3;
  57. unsigned long __uclibc_unused4;
  58. };
  59. /* The user should define a union like the following to use it for arguments
  60. for `semctl'.
  61. union semun
  62. {
  63. int val; <= value for SETVAL
  64. struct semid_ds *buf; <= buffer for IPC_STAT & IPC_SET
  65. unsigned short int *array; <= array for GETALL & SETALL
  66. struct seminfo *__buf; <= buffer for IPC_INFO
  67. };
  68. Previous versions of this file used to define this union but this is
  69. incorrect. One can test the macro _SEM_SEMUN_UNDEFINED to see whether
  70. one must define the union or not. */
  71. #define _SEM_SEMUN_UNDEFINED 1
  72. #ifdef __USE_MISC
  73. /* ipcs ctl cmds */
  74. # define SEM_STAT 18
  75. # define SEM_INFO 19
  76. struct seminfo
  77. {
  78. int semmap;
  79. int semmni;
  80. int semmns;
  81. int semmnu;
  82. int semmsl;
  83. int semopm;
  84. int semume;
  85. int semusz;
  86. int semvmx;
  87. int semaem;
  88. };
  89. #endif /* __USE_MISC */