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
11
13 semaphore.h — semaphores
14
16 #include <semaphore.h>
17
19 The <semaphore.h> header shall define the sem_t type, used in perform‐
20 ing semaphore operations. The semaphore may be implemented using a file
21 descriptor, in which case applications are able to open up at least a
22 total of {OPEN_MAX} files and semaphores.
23
24 The <semaphore.h> header shall define the symbolic constant SEM_FAILED
25 which shall have type sem_t *.
26
27 The following shall be declared as functions and may also be defined as
28 macros. Function prototypes shall be provided.
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‐2008, 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, 2013 Edition, Standard for Information Technology
65 -- Portable Operating System Interface (POSIX), The Open Group Base
66 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
67 cal and Electronics Engineers, Inc and The Open Group. (This is
68 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
69 event of any discrepancy between this version and the original IEEE and
70 The Open Group Standard, the original IEEE and The Open Group Standard
71 is the referee document. The original Standard can be obtained online
72 at http://www.unix.org/online.html .
73
74 Any typographical or formatting errors that appear in this page are
75 most likely to have been introduced during the conversion of the source
76 files to man page format. To report such errors, see https://www.ker‐
77 nel.org/doc/man-pages/reporting_bugs.html .
78
79
80
81IEEE/The Open Group 2013 semaphore.h(0P)