sem.h 2.9 KB

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