1
0

sem.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. //
  2. // Copyright 2026 Aarav Ravindra Kharade
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. //
  16. /* Copyright (C) 1995-2026 Free Software Foundation, Inc.
  17. This file is part of the GNU C Library.
  18. The GNU C Library is free software; you can redistribute it and/or
  19. modify it under the terms of the GNU Lesser General Public
  20. License as published by the Free Software Foundation; either
  21. version 2.1 of the License, or (at your option) any later version.
  22. The GNU C Library is distributed in the hope that it will be useful,
  23. but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  25. Lesser General Public License for more details.
  26. You should have received a copy of the GNU Lesser General Public
  27. License along with the GNU C Library; if not, see
  28. <https://www.gnu.org/licenses/>. */
  29. #ifndef _SYS_SEM_H
  30. # error "Never include <bits/sem.h> directly; use <sys/sem.h> instead."
  31. #endif
  32. #include <sys/types.h>
  33. #include <bits/timesize.h>
  34. #include <bits/types/struct_semid_ds.h>
  35. #include <bits/types/struct_semid64_ds.h>
  36. /* Flags for `semop'. */
  37. #define SEM_UNDO 0x1000 /* undo the operation on exit */
  38. /* Commands for `semctl'. */
  39. #define GETPID 11 /* get sempid */
  40. #define GETVAL 12 /* get semval */
  41. #define GETALL 13 /* get all semval's */
  42. #define GETNCNT 14 /* get semncnt */
  43. #define GETZCNT 15 /* get semzcnt */
  44. #define SETVAL 16 /* set semval */
  45. #define SETALL 17 /* set all semval's */
  46. /* The user should define a union like the following to use it for arguments
  47. for `semctl'.
  48. union semun
  49. {
  50. int val; <= value for SETVAL
  51. struct semid_ds *buf; <= buffer for IPC_STAT & IPC_SET
  52. unsigned short int *array; <= array for GETALL & SETALL
  53. struct seminfo *__buf; <= buffer for IPC_INFO
  54. };
  55. Previous versions of this file used to define this union but this is
  56. incorrect. One can test the macro _SEM_SEMUN_UNDEFINED to see whether
  57. one must define the union or not. */
  58. #define _SEM_SEMUN_UNDEFINED 1
  59. #ifdef __USE_MISC
  60. /* ipcs ctl cmds */
  61. # define SEM_STAT 18
  62. # define SEM_INFO 19
  63. # define SEM_STAT_ANY 20
  64. struct seminfo
  65. {
  66. int semmap;
  67. int semmni;
  68. int semmns;
  69. int semmnu;
  70. int semmsl;
  71. int semopm;
  72. int semume;
  73. int semusz;
  74. int semvmx;
  75. int semaem;
  76. };
  77. #endif /* __USE_MISC */