| 1 | /* Copyright (C) 1995-2021 Free Software Foundation, Inc. |
| 2 | This file is part of the GNU C Library. |
| 3 | |
| 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 | |
| 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 | |
| 14 | You should have received a copy of the GNU Lesser General Public |
| 15 | License along with the GNU C Library; if not, see |
| 16 | <https://www.gnu.org/licenses/>. */ |
| 17 | |
| 18 | #ifndef _SYS_SEM_H |
| 19 | # error "Never include <bits/sem.h> directly; use <sys/sem.h> instead." |
| 20 | #endif |
| 21 | |
| 22 | #include <sys/types.h> |
| 23 | #include <bits/timesize.h> |
| 24 | #include <bits/types/struct_semid_ds.h> |
| 25 | |
| 26 | /* Flags for `semop'. */ |
| 27 | #define SEM_UNDO 0x1000 /* undo the operation on exit */ |
| 28 | |
| 29 | /* Commands for `semctl'. */ |
| 30 | #define GETPID 11 /* get sempid */ |
| 31 | #define GETVAL 12 /* get semval */ |
| 32 | #define GETALL 13 /* get all semval's */ |
| 33 | #define GETNCNT 14 /* get semncnt */ |
| 34 | #define GETZCNT 15 /* get semzcnt */ |
| 35 | #define SETVAL 16 /* set semval */ |
| 36 | #define SETALL 17 /* set all semval's */ |
| 37 | |
| 38 | /* The user should define a union like the following to use it for arguments |
| 39 | for `semctl'. |
| 40 | |
| 41 | union semun |
| 42 | { |
| 43 | int val; <= value for SETVAL |
| 44 | struct semid_ds *buf; <= buffer for IPC_STAT & IPC_SET |
| 45 | unsigned short int *array; <= array for GETALL & SETALL |
| 46 | struct seminfo *__buf; <= buffer for IPC_INFO |
| 47 | }; |
| 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 | |
| 54 | #ifdef __USE_MISC |
| 55 | |
| 56 | /* ipcs ctl cmds */ |
| 57 | # define SEM_STAT 18 |
| 58 | # define SEM_INFO 19 |
| 59 | # define SEM_STAT_ANY 20 |
| 60 | |
| 61 | struct seminfo |
| 62 | { |
| 63 | int semmap; |
| 64 | int semmni; |
| 65 | int semmns; |
| 66 | int semmnu; |
| 67 | int semmsl; |
| 68 | int semopm; |
| 69 | int semume; |
| 70 | int semusz; |
| 71 | int semvmx; |
| 72 | int semaem; |
| 73 | }; |
| 74 | |
| 75 | #endif /* __USE_MISC */ |
| 76 | |