Debian Codegraph @

upstream/debian-trixie/man3/sem_close.3

raw
1 '\" t
2 .\" Copyright (C) 2006 Michael Kerrisk <[email protected]>
3 .\"
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\"
6 .TH sem_close 3 2024-05-02 "Linux man-pages 6.9.1"
7 .SH NAME
8 sem_close \- close a named semaphore
9 .SH LIBRARY
10 POSIX threads library
11 .RI ( libpthread ", " \-lpthread )
12 .SH SYNOPSIS
13 .nf
14 .B #include <semaphore.h>
15 .P
16 .BI "int sem_close(sem_t *" sem );
17 .fi
18 .SH DESCRIPTION
19 .BR sem_close ()
20 closes the named semaphore referred to by
21 .IR sem ,
22 allowing any resources that the system has allocated to
23 the calling process for this semaphore to be freed.
24 .SH RETURN VALUE
25 On success
26 .BR sem_close ()
27 returns 0; on error, \-1 is returned, with
28 .I errno
29 set to indicate the error.
30 .SH ERRORS
31 .TP
32 .B EINVAL
33 .I sem
34 is not a valid semaphore.
35 .SH ATTRIBUTES
36 For an explanation of the terms used in this section, see
37 .BR attributes (7).
38 .TS
39 allbox;
40 lbx lb lb
41 l l l.
42 Interface Attribute Value
43 T{
44 .na
45 .nh
46 .BR sem_close ()
47 T} Thread safety MT-Safe
48 .TE
49 .SH STANDARDS
50 POSIX.1-2008.
51 .SH HISTORY
52 POSIX.1-2001.
53 .SH NOTES
54 All open named semaphores are automatically closed on process
55 termination, or upon
56 .BR execve (2).
57 .SH SEE ALSO
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)