]>
Commit | Line | Data |
---|---|---|
c11b1abf | 1 | .\" Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com> |
2c731798 | 2 | .\" |
5fbde956 | 3 | .\" SPDX-License-Identifier: Linux-man-pages-copyleft |
2c731798 | 4 | .\" |
4c1c5274 | 5 | .TH sem_close 3 (date) "Linux man-pages (unreleased)" |
2c731798 MK |
6 | .SH NAME |
7 | sem_close \- close a named semaphore | |
ad3209fc AC |
8 | .SH LIBRARY |
9 | POSIX threads library | |
8fc3b2cf | 10 | .RI ( libpthread ", " \-lpthread ) |
2c731798 MK |
11 | .SH SYNOPSIS |
12 | .nf | |
13 | .B #include <semaphore.h> | |
68e4db0a | 14 | .PP |
2c731798 MK |
15 | .BI "int sem_close(sem_t *" sem ); |
16 | .fi | |
17 | .SH DESCRIPTION | |
18 | .BR sem_close () | |
19 | closes the named semaphore referred to by | |
20 | .IR sem , | |
c13182ef | 21 | allowing any resources that the system has allocated to |
011ed91c | 22 | the calling process for this semaphore to be freed. |
2c731798 MK |
23 | .SH RETURN VALUE |
24 | On success | |
25 | .BR sem_close () | |
26 | returns 0; on error, \-1 is returned, with | |
c13182ef | 27 | .I errno |
2c731798 MK |
28 | set to indicate the error. |
29 | .SH ERRORS | |
30 | .TP | |
31 | .B EINVAL | |
32 | .I sem | |
33 | is not a valid semaphore. | |
011b5251 ZL |
34 | .SH ATTRIBUTES |
35 | For an explanation of the terms used in this section, see | |
36 | .BR attributes (7). | |
c466875e MK |
37 | .ad l |
38 | .nh | |
011b5251 ZL |
39 | .TS |
40 | allbox; | |
c466875e | 41 | lbx lb lb |
011b5251 ZL |
42 | l l l. |
43 | Interface Attribute Value | |
44 | T{ | |
45 | .BR sem_close () | |
46 | T} Thread safety MT-Safe | |
47 | .TE | |
c466875e MK |
48 | .hy |
49 | .ad | |
847e0d88 | 50 | .sp 1 |
3113c7f3 | 51 | .SH STANDARDS |
84295a7c | 52 | POSIX.1-2001, POSIX.1-2008. |
2b2581ee MK |
53 | .SH NOTES |
54 | All open named semaphores are automatically closed on process | |
55 | termination, or upon | |
56 | .BR execve (2). | |
47297adb | 57 | .SH SEE ALSO |
2c731798 MK |
58 | .BR sem_getvalue (3), |
59 | .BR sem_open (3), | |
60 | .BR sem_post (3), | |
61 | .BR sem_unlink (3), | |
62 | .BR sem_wait (3), | |
63 | .BR sem_overview (7) |