1sys_sem.h(0P)              POSIX Programmer's Manual             sys_sem.h(0P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       sys/sem.h — XSI semaphore facility
13

SYNOPSIS

15       #include <sys/sem.h>
16

DESCRIPTION

18       The <sys/sem.h> header shall define the following symbolic constant for
19       use as a semaphore operation flag:
20
21       SEM_UNDO    Set up adjust on exit entry.
22
23       The  <sys/sem.h>  header  shall define the following symbolic constants
24       for use as commands for the semctl() function:
25
26       GETNCNT     Get semncnt.
27
28       GETPID      Get sempid.
29
30       GETVAL      Get semval.
31
32       GETALL      Get all cases of semval.
33
34       GETZCNT     Get semzcnt.
35
36       SETVAL      Set semval.
37
38       SETALL      Set all cases of semval.
39
40       The <sys/sem.h> header shall define the semid_ds structure, which shall
41       include 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() time.
47           time_t           sem_ctime Last time changed by semctl().
48
49       The <sys/sem.h> header shall define the pid_t, size_t, and time_t types
50       as described in <sys/types.h>.
51
52       A semaphore shall be represented by an anonymous structure, which shall
53       include the following members:
54
55
56           unsigned short  semval   Semaphore value.
57           pid_t           sempid   Process ID of last operation.
58           unsigned short  semncnt  Number of processes waiting for semval
59                                    to become greater than current value.
60           unsigned short  semzcnt  Number of processes waiting for semval
61                                    to become 0.
62
63       The  <sys/sem.h>  header shall define the sembuf structure, which shall
64       include the following members:
65
66
67           unsigned short  sem_num   Semaphore number.
68           short           sem_op    Semaphore operation.
69           short           sem_flg   Operation flags.
70
71       The following shall be declared as functions and may also be defined as
72       macros. Function prototypes shall be provided.
73
74
75           int   semctl(int, int, int, ...);
76           int   semget(key_t, int, int);
77           int   semop(int, struct sembuf *, size_t);
78
79       In  addition,  the  <sys/sem.h>  header  shall  include the <sys/ipc.h>
80       header.
81
82       The following sections are informative.
83

APPLICATION USAGE

85       None.
86

RATIONALE

88       None.
89

FUTURE DIRECTIONS

91       None.
92

SEE ALSO

94       <sys_ipc.h>, <sys_types.h>
95
96       The System  Interfaces  volume  of  POSIX.1‐2017,  semctl(),  semget(),
97       semop()
98
100       Portions  of  this text are reprinted and reproduced in electronic form
101       from IEEE Std 1003.1-2017, Standard for Information Technology --  Por‐
102       table  Operating System Interface (POSIX), The Open Group Base Specifi‐
103       cations Issue 7, 2018 Edition, Copyright (C) 2018 by the  Institute  of
104       Electrical  and  Electronics Engineers, Inc and The Open Group.  In the
105       event of any discrepancy between this version and the original IEEE and
106       The  Open Group Standard, the original IEEE and The Open Group Standard
107       is the referee document. The original Standard can be  obtained  online
108       at http://www.opengroup.org/unix/online.html .
109
110       Any  typographical  or  formatting  errors that appear in this page are
111       most likely to have been introduced during the conversion of the source
112       files  to  man page format. To report such errors, see https://www.ker
113       nel.org/doc/man-pages/reporting_bugs.html .
114
115
116
117IEEE/The Open Group                  2017                        sys_sem.h(0P)
Impressum