]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/sem_close.3
proc.5: Note kernel version for /proc/PID/smaps VmFlags "wf" flag
[thirdparty/man-pages.git] / man3 / sem_close.3
CommitLineData
2c731798 1'\" t
c11b1abf 2.\" Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
2c731798 3.\"
93015253 4.\" %%%LICENSE_START(VERBATIM)
2c731798
MK
5.\" Permission is granted to make and distribute verbatim copies of this
6.\" manual provided the copyright notice and this permission notice are
7.\" preserved on all copies.
8.\"
9.\" Permission is granted to copy and distribute modified versions of this
10.\" manual under the conditions for verbatim copying, provided that the
11.\" entire resulting derived work is distributed under the terms of a
12.\" permission notice identical to this one.
c13182ef 13.\"
2c731798
MK
14.\" Since the Linux kernel and libraries are constantly changing, this
15.\" manual page may be incorrect or out-of-date. The author(s) assume no
16.\" responsibility for errors or omissions, or for damages resulting from
10d76543
MK
17.\" the use of the information contained herein. The author(s) may not
18.\" have taken the same level of care in the production of this manual,
19.\" which is licensed free of charge, as they might when working
20.\" professionally.
c13182ef 21.\"
2c731798
MK
22.\" Formatted or processed versions of this manual, if unaccompanied by
23.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 24.\" %%%LICENSE_END
2c731798 25.\"
4b8c67d9 26.TH SEM_CLOSE 3 2017-09-15 "Linux" "Linux Programmer's Manual"
2c731798
MK
27.SH NAME
28sem_close \- close a named semaphore
29.SH SYNOPSIS
30.nf
31.B #include <semaphore.h>
68e4db0a 32.PP
2c731798
MK
33.BI "int sem_close(sem_t *" sem );
34.fi
68e4db0a 35.PP
2c5f8c8c 36Link with \fI\-pthread\fP.
2c731798
MK
37.SH DESCRIPTION
38.BR sem_close ()
39closes the named semaphore referred to by
40.IR sem ,
c13182ef 41allowing any resources that the system has allocated to
011ed91c 42the calling process for this semaphore to be freed.
2c731798
MK
43.SH RETURN VALUE
44On success
45.BR sem_close ()
46returns 0; on error, \-1 is returned, with
c13182ef 47.I errno
2c731798
MK
48set to indicate the error.
49.SH ERRORS
50.TP
51.B EINVAL
52.I sem
53is not a valid semaphore.
011b5251
ZL
54.SH ATTRIBUTES
55For an explanation of the terms used in this section, see
56.BR attributes (7).
57.TS
58allbox;
59lb lb lb
60l l l.
61Interface Attribute Value
62T{
63.BR sem_close ()
64T} Thread safety MT-Safe
65.TE
847e0d88 66.sp 1
2c731798 67.SH CONFORMING TO
84295a7c 68POSIX.1-2001, POSIX.1-2008.
2b2581ee
MK
69.SH NOTES
70All open named semaphores are automatically closed on process
71termination, or upon
72.BR execve (2).
47297adb 73.SH SEE ALSO
2c731798
MK
74.BR sem_getvalue (3),
75.BR sem_open (3),
76.BR sem_post (3),
77.BR sem_unlink (3),
78.BR sem_wait (3),
79.BR sem_overview (7)