sem.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. __time_t sem_otime; /* last semop() time */
  37. #if __WORDSIZE == 32
  38. unsigned int __uclibc_unused2;
  39. #endif
  40. __time_t sem_ctime; /* last time changed by semctl() */
  41. unsigned long int sem_nsems; /* number of semaphores in set */
  42. unsigned long __uclibc_unused3;
  43. unsigned long __uclibc_unused4;
  44. };
  45. /* The user should define a union like the following to use it for arguments
  46. for `semctl'.
  47. union semun
  48. {
  49. int val; <= value for SETVAL
  50. struct semid_ds *buf; <= buffer for IPC_STAT & IPC_SET
  51. unsigned short int *array; <= array for GETALL & SETALL
  52. struct seminfo *__buf; <= buffer for IPC_INFO
  53. };
  54. Previous versions of this file used to define this union but this is
  55. incorrect. One can test the macro _SEM_SEMUN_UNDEFINED to see whether
  56. one must define the union or not. */
  57. #define _SEM_SEMUN_UNDEFINED 1
  58. #ifdef __USE_MISC
  59. /* ipcs ctl cmds */
  60. # define SEM_STAT 18
  61. # define SEM_INFO 19
  62. struct seminfo
  63. {
  64. int semmap;
  65. int semmni;
  66. int semmns;
  67. int semmnu;
  68. int semmsl;
  69. int semopm;
  70. int semume;
  71. int semusz;
  72. int semvmx;
  73. int semaem;
  74. };
  75. #endif /* __USE_MISC */