sem.h 2.5 KB

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