blob: f9c763835961ec32e47dedb2fb332f33d600f30e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
@node Inter-Process Communication, Job Control, Processes, Top
@c %MENU% All about inter-process communication
@chapter Inter-Process Communication
@cindex ipc
This chapter describes the @glibcadj{} inter-process communication primitives.
@menu
* Semaphores:: Support for creating and managing semaphores
@end menu
@node Semaphores
@section Semaphores
@Theglibc{} implements the semaphore APIs as defined in POSIX and
System V. Semaphores can be used by multiple processes to coordinate shared
resources. The following is a complete list of the semaphore functions provided
by @theglibc{}.
@c Need descriptions for all of these functions.
@subsection System V Semaphores
@deftypefun int semctl (int @var{semid}, int @var{semnum}, int @var{cmd})
@safety{@prelim{}@mtsafe{}@assafe{}@acunsafe{@acucorrupt{/linux}}}
@c syscall(ipc) ok
@c
@c AC-unsafe because we need to translate the new kernel
@c semid_ds buf into the userspace layout. Cancellation
@c at that point results in an inconsistent userspace
@c semid_ds.
@end deftypefun
@deftypefun int semget (key_t @var{key}, int @var{nsems}, int @var{semflg})
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
@c syscall(ipc) ok
@end deftypefun
@deftypefun int semop (int @var{semid}, struct sembuf *@var{sops}, size_t @var{nsops})
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
@c syscall(ipc) ok
@end deftypefun
@deftypefun int semtimedop (int @var{semid}, struct sembuf *@var{sops}, size_t @var{nsops}, const struct timespec *@var{timeout})
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
@c syscall(ipc) ok
@end deftypefun
@subsection POSIX Semaphores
@Theglibc{} provides POSIX semaphores as well. These functions' names begin
with @code{sem_} and they are declared in @file{semaphore.h}. @xref{POSIX
Semaphores}.
|