1semaphore.h(0P) POSIX Programmer's Manual semaphore.h(0P)
2
3
4
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
12 semaphore.h — semaphores
13
15 #include <semaphore.h>
16
18 The <semaphore.h> header shall define the sem_t type, used in perform‐
19 ing semaphore operations. The semaphore may be implemented using a file
20 descriptor, in which case applications are able to open up at least a
21 total of {OPEN_MAX} files and semaphores.
22
23 The <semaphore.h> header shall define the symbolic constant SEM_FAILED
24 which shall have type sem_t *.
25
26 The following shall be declared as functions and may also be defined as
27 macros. Function prototypes shall be provided.
28
29
30 int sem_close(sem_t *);
31 int sem_destroy(sem_t *);
32 int sem_getvalue(sem_t *restrict, int *restrict);
33 int sem_init(sem_t *, int, unsigned);
34 sem_t *sem_open(const char *, int, ...);
35 int sem_post(sem_t *);
36 int sem_timedwait(sem_t *restrict, const struct timespec *restrict);
37 int sem_trywait(sem_t *);
38 int sem_unlink(const char *);
39 int sem_wait(sem_t *);
40
41 Inclusion of the <semaphore.h> header may make visible symbols defined
42 in the <fcntl.h> and <time.h> headers.
43
44 The following sections are informative.
45
47 None.
48
50 None.
51
53 None.
54
56 <fcntl.h>, <sys_types.h>, <time.h>
57
58 The System Interfaces volume of POSIX.1‐2017, sem_close(),
59 sem_destroy(), sem_getvalue(), sem_init(), sem_open(), sem_post(),
60 sem_timedwait(), sem_trywait(), sem_unlink()
61
63 Portions of this text are reprinted and reproduced in electronic form
64 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
65 table Operating System Interface (POSIX), The Open Group Base Specifi‐
66 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
67 Electrical and Electronics Engineers, Inc and The Open Group. In the
68 event of any discrepancy between this version and the original IEEE and
69 The Open Group Standard, the original IEEE and The Open Group Standard
70 is the referee document. The original Standard can be obtained online
71 at http://www.opengroup.org/unix/online.html .
72
73 Any typographical or formatting errors that appear in this page are
74 most likely to have been introduced during the conversion of the source
75 files to man page format. To report such errors, see https://www.ker‐
76 nel.org/doc/man-pages/reporting_bugs.html .
77
78
79
80IEEE/The Open Group 2017 semaphore.h(0P)