]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/sem_close.3
man*/: srcfix (Use .P instead of .PP or .LP)
[thirdparty/man-pages.git] / man3 / sem_close.3
CommitLineData
a1eaacb1 1'\" t
c11b1abf 2.\" Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
2c731798 3.\"
5fbde956 4.\" SPDX-License-Identifier: Linux-man-pages-copyleft
2c731798 5.\"
4c1c5274 6.TH sem_close 3 (date) "Linux man-pages (unreleased)"
2c731798
MK
7.SH NAME
8sem_close \- close a named semaphore
ad3209fc
AC
9.SH LIBRARY
10POSIX threads library
8fc3b2cf 11.RI ( libpthread ", " \-lpthread )
2c731798
MK
12.SH SYNOPSIS
13.nf
14.B #include <semaphore.h>
c6d039a3 15.P
2c731798
MK
16.BI "int sem_close(sem_t *" sem );
17.fi
18.SH DESCRIPTION
19.BR sem_close ()
20closes the named semaphore referred to by
21.IR sem ,
c13182ef 22allowing any resources that the system has allocated to
011ed91c 23the calling process for this semaphore to be freed.
2c731798
MK
24.SH RETURN VALUE
25On success
26.BR sem_close ()
27returns 0; on error, \-1 is returned, with
c13182ef 28.I errno
2c731798
MK
29set to indicate the error.
30.SH ERRORS
31.TP
32.B EINVAL
33.I sem
34is not a valid semaphore.
011b5251
ZL
35.SH ATTRIBUTES
36For an explanation of the terms used in this section, see
37.BR attributes (7).
38.TS
39allbox;
c466875e 40lbx lb lb
011b5251
ZL
41l l l.
42Interface Attribute Value
43T{
9e54434e
BR
44.na
45.nh
011b5251
ZL
46.BR sem_close ()
47T} Thread safety MT-Safe
48.TE
3113c7f3 49.SH STANDARDS
4131356c
AC
50POSIX.1-2008.
51.SH HISTORY
52POSIX.1-2001.
2b2581ee
MK
53.SH NOTES
54All open named semaphores are automatically closed on process
55termination, 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)