sem.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /* Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001 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. /* Flags for `semop'. */
  19. #define SEM_UNDO 0x1000 /* undo the operation on exit */
  20. /* Commands for `semctl'. */
  21. #define GETPID 11 /* get sempid */
  22. #define GETVAL 12 /* get semval */
  23. #define GETALL 13 /* get all semval's */
  24. #define GETNCNT 14 /* get semncnt */
  25. #define GETZCNT 15 /* get semzcnt */
  26. #define SETVAL 16 /* set semval */
  27. #define SETALL 17 /* set all semval's */
  28. /* Data structure describing a set of semaphores. */
  29. struct semid_ds
  30. {
  31. struct ipc_perm sem_perm; /* operation permission struct */
  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. unsigned long int __sem_ctime_internal_1; /* last time changed by semctl() */
  36. unsigned long int __sem_ctime_internal_2;
  37. #else
  38. __time_t sem_otime; /* last semop() time */
  39. __time_t sem_ctime; /* last time changed by semctl() */
  40. #endif
  41. unsigned long int sem_nsems; /* number of semaphores in set */
  42. #if defined(__UCLIBC_USE_TIME64__)
  43. __time_t sem_otime;
  44. __time_t sem_ctime;
  45. #endif
  46. unsigned long int __uclibc_unused1;
  47. unsigned long int __uclibc_unused2;
  48. };
  49. /* The user should define a union like the following to use it for arguments
  50. for `semctl'.
  51. union semun
  52. {
  53. int val; <= value for SETVAL
  54. struct semid_ds *buf; <= buffer for IPC_STAT & IPC_SET
  55. unsigned short int *array; <= array for GETALL & SETALL
  56. struct seminfo *__buf; <= buffer for IPC_INFO
  57. };
  58. Previous versions of this file used to define this union but this is
  59. incorrect. One can test the macro _SEM_SEMUN_UNDEFINED to see whether
  60. one must define the union or not. */
  61. #define _SEM_SEMUN_UNDEFINED 1
  62. #ifdef __USE_MISC
  63. /* ipcs ctl cmds */
  64. # define SEM_STAT 18
  65. # define SEM_INFO 19
  66. struct seminfo
  67. {
  68. int semmap;
  69. int semmni;
  70. int semmns;
  71. int semmnu;
  72. int semmsl;
  73. int semopm;
  74. int semume;
  75. int semusz;
  76. int semvmx;
  77. int semaem;
  78. };
  79. #endif /* __USE_MISC */