1<sys/sem.h>(0P) POSIX Programmer's Manual <sys/sem.h>(0P)
2
3
4
6 sys/sem.h - XSI semaphore facility
7
9 #include <sys/sem.h>
10
12 The <sys/sem.h> header shall define the following constants and struc‐
13 tures.
14
15 Semaphore operation flags:
16
17 SEM_UNDO
18 Set up adjust on exit entry.
19
20
21 Command definitions for the semctl() function shall be provided as fol‐
22 lows:
23
24 GETNCNT
25 Get semncnt.
26
27 GETPID Get sempid.
28
29 GETVAL Get semval.
30
31 GETALL Get all cases of semval.
32
33 GETZCNT
34 Get semzcnt.
35
36 SETVAL Set semval.
37
38 SETALL Set all cases of semval.
39
40
41 The semid_ds structure shall contain the following members:
42
43
44 struct ipc_perm sem_perm Operation permission structure.
45 unsigned short sem_nsems Number of semaphores in set.
46 time_t sem_otime Last semop
47 () time.
48 time_t sem_ctime Last time changed by semctl
49 ().
50
51 The pid_t, time_t, key_t, and size_t types shall be defined as
52 described in <sys/types.h> .
53
54 A semaphore shall be represented by an anonymous structure containing
55 the following members:
56
57
58 unsigned short semval Semaphore value.
59 pid_t sempid Process ID of last operation.
60 unsigned short semncnt Number of processes waiting for semval
61 to become greater than current value.
62 unsigned short semzcnt Number of processes waiting for semval
63 to become 0.
64
65 The sembuf structure shall contain the following members:
66
67
68 unsigned short sem_num Semaphore number.
69 short sem_op Semaphore operation.
70 short sem_flg Operation flags.
71
72 The following shall be declared as functions and may also be defined as
73 macros. Function prototypes shall be provided.
74
75
76 int semctl(int, int, int, ...);
77 int semget(key_t, int, int);
78 int semop(int, struct sembuf *, size_t);
79
80 In addition, all of the symbols from <sys/ipc.h> shall be defined when
81 this header is included.
82
83 The following sections are informative.
84
86 None.
87
89 None.
90
92 None.
93
95 <sys/ipc.h>, <sys/types.h>, semctl(), semget(), semop()
96
98 Portions of this text are reprinted and reproduced in electronic form
99 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
100 -- Portable Operating System Interface (POSIX), The Open Group Base
101 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
102 Electrical and Electronics Engineers, Inc and The Open Group. In the
103 event of any discrepancy between this version and the original IEEE and
104 The Open Group Standard, the original IEEE and The Open Group Standard
105 is the referee document. The original Standard can be obtained online
106 at http://www.opengroup.org/unix/online.html .
107
108
109
110IEEE/The Open Group 2003 <sys/sem.h>(0P)