sem.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* Copyright (C) 1995-2026 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. <https://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/timesize.h>
  19. #include <bits/types/struct_semid_ds.h>
  20. #include <bits/types/struct_semid64_ds.h>
  21. /* Flags for `semop'. */
  22. #define SEM_UNDO 0x1000 /* undo the operation on exit */
  23. /* Commands for `semctl'. */
  24. #define GETPID 11 /* get sempid */
  25. #define GETVAL 12 /* get semval */
  26. #define GETALL 13 /* get all semval's */
  27. #define GETNCNT 14 /* get semncnt */
  28. #define GETZCNT 15 /* get semzcnt */
  29. #define SETVAL 16 /* set semval */
  30. #define SETALL 17 /* set all semval's */
  31. /* The user should define a union like the following to use it for arguments
  32. for `semctl'.
  33. union semun
  34. {
  35. int val; <= value for SETVAL
  36. struct semid_ds *buf; <= buffer for IPC_STAT & IPC_SET
  37. unsigned short int *array; <= array for GETALL & SETALL
  38. struct seminfo *__buf; <= buffer for IPC_INFO
  39. };
  40. Previous versions of this file used to define this union but this is
  41. incorrect. One can test the macro _SEM_SEMUN_UNDEFINED to see whether
  42. one must define the union or not. */
  43. #define _SEM_SEMUN_UNDEFINED 1
  44. #ifdef __USE_MISC
  45. /* ipcs ctl cmds */
  46. # define SEM_STAT 18
  47. # define SEM_INFO 19
  48. # define SEM_STAT_ANY 20
  49. struct seminfo
  50. {
  51. int semmap;
  52. int semmni;
  53. int semmns;
  54. int semmnu;
  55. int semmsl;
  56. int semopm;
  57. int semume;
  58. int semusz;
  59. int semvmx;
  60. int semaem;
  61. };
  62. #endif /* __USE_MISC */