]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/gnu/bits/sem.h
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / gnu / bits / sem.h
CommitLineData
04277e02 1/* Copyright (C) 1995-2019 Free Software Foundation, Inc.
8a4b65b4 2 This file is part of the GNU C Library.
d2f5be2a 3
8a4b65b4 4 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
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.
d2f5be2a 8
8a4b65b4
UD
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
41bdb6e2 12 Lesser General Public License for more details.
d2f5be2a 13
41bdb6e2 14 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
d2f5be2a 17
f4017d20
UD
18#ifndef _SYS_SEM_H
19# error "Never include <bits/sem.h> directly; use <sys/sem.h> instead."
20#endif
8a4b65b4 21
d2f5be2a
UD
22#include <sys/types.h>
23
24/* Flags for `semop'. */
25#define SEM_UNDO 0x1000 /* undo the operation on exit */
26
27/* Commands for `semctl'. */
28#define GETPID 11 /* get sempid */
29#define GETVAL 12 /* get semval */
30#define GETALL 13 /* get all semval's */
31#define GETNCNT 14 /* get semncnt */
32#define GETZCNT 15 /* get semzcnt */
33#define SETVAL 16 /* set semval */
34#define SETALL 17 /* set all semval's */
35
36
d2f5be2a
UD
37/* Data structure describing a set of semaphores. */
38struct semid_ds
39{
6d52618b 40 struct ipc_perm sem_perm; /* operation permission struct */
d2f5be2a
UD
41 __time_t sem_otime; /* last semop() time */
42 __time_t sem_ctime; /* last time changed by semctl() */
43 struct sem *__sembase; /* ptr to first semaphore in array */
0ed99ce4
UD
44 struct __sem_queue *__sem_pending; /* pending operations */
45 struct __sem_queue *__sem_pending_last;/* last pending operation */
46 struct __sem_undo *__undo; /* ondo requests on this array */
d2f5be2a
UD
47 unsigned short int sem_nsems; /* number of semaphores in set */
48};
49
df493c3b
UD
50
51/* The user should define a union like the following to use it for arguments
52 for `semctl'.
53
54 union semun
55 {
56 int val; <= value for SETVAL
57 struct semid_ds *buf; <= buffer for IPC_STAT & IPC_SET
58 unsigned short int *array; <= array for GETALL & SETALL
59 struct seminfo *__buf; <= buffer for IPC_INFO
60 };
61
62 Previous versions of this file used to define this union but this is
63 incorrect. One can test the macro _SEM_SEMUN_UNDEFINED to see whether
977bfd77 64 one must define the union or not. */
df493c3b 65#define _SEM_SEMUN_UNDEFINED 1
d2f5be2a 66
84724245
RM
67#ifdef __USE_MISC
68
69/* ipcs ctl cmds */
f4017d20
UD
70# define SEM_STAT 18
71# define SEM_INFO 19
84724245 72
8a4b65b4
UD
73struct seminfo
74{
75 int semmap;
76 int semmni;
77 int semmns;
78 int semmnu;
79 int semmsl;
80 int semopm;
81 int semume;
82 int semusz;
83 int semvmx;
84 int semaem;
84724245
RM
85};
86
87#endif /* __USE_MISC */