7139 Sync mDNS with mDNSResponder-625.41.2
[unleashed.git] / usr / src / man / man3c / sem_close.3c
blob801ac40beb827d39e297f69dd72fd102c288669d
1 '\" te
2 .\" Copyright (c) 2008, Sun Microsystems, Inc.  All Rights Reserved
3 .\" Copyright 1989 AT&T
4 .\" Portions Copyright (c) 1992, X/Open Company Limited  All Rights Reserved
5 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
6 .\" http://www.opengroup.org/bookstore/.
7 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
8 .\"  This notice shall appear on any product containing this material.
9 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
10 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
11 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
12 .TH SEM_CLOSE 3C "Feb 5, 2008"
13 .SH NAME
14 sem_close \- close a named semaphore
15 .SH SYNOPSIS
16 .LP
17 .nf
18 #include <semaphore.h>
20 \fBint\fR \fBsem_close\fR(\fBsem_t *\fR\fIsem\fR);
21 .fi
23 .SH DESCRIPTION
24 .sp
25 .LP
26 The \fBsem_close()\fR function is used to indicate that the calling process is
27 finished using the named semaphore indicated by \fIsem\fR. The effects of
28 calling \fBsem_close()\fR for an unnamed semaphore (one created by
29 \fBsem_init\fR(3C)) are undefined. The \fBsem_close()\fR function deallocates
30 (that is, make available for reuse by a subsequent \fBsem_open\fR(3C) by this
31 process) any system resources allocated by the system for use by this process
32 for this semaphore. The effect of subsequent use of the semaphore indicated by
33 \fIsem\fR by this process is undefined. If the semaphore has not been removed
34 with a successful call to \fBsem_unlink\fR(3C), then \fBsem_close()\fR has no
35 effect on the state of the semaphore. If the \fBsem_unlink\fR(3C) function has
36 been successfully invoked for \fIname\fR after the most recent call to
37 \fBsem_open\fR(3C) with \fBO_CREAT\fR for this semaphore, then when all
38 processes that have opened the semaphore close it, the semaphore is no longer
39 be accessible.
40 .SH RETURN VALUES
41 .sp
42 .LP
43 If successful, \fBsem_close()\fR returns \fB0\fR, otherwise it returns
44 \fB\(mi1\fR and sets \fBerrno\fR to indicate the error.
45 .SH ERRORS
46 .sp
47 .LP
48 The \fBsem_close()\fR function will fail if:
49 .sp
50 .ne 2
51 .na
52 \fB\fBEINVAL\fR \fR
53 .ad
54 .RS 11n
55 The \fIsem\fR argument is not a valid semaphore descriptor.
56 .RE
58 .sp
59 .ne 2
60 .na
61 \fB\fBENOSYS\fR \fR
62 .ad
63 .RS 11n
64 The \fBsem_close()\fR function is not supported by the system.
65 .RE
67 .SH USAGE
68 .sp
69 .LP
70 The \fBsem_close()\fR function should not be called for an unnamed semaphore
71 initialized by \fBsem_init\fR(3C).
72 .SH ATTRIBUTES
73 .sp
74 .LP
75 See \fBattributes\fR(5) for descriptions of the following attributes:
76 .sp
78 .sp
79 .TS
80 box;
81 c | c
82 l | l .
83 ATTRIBUTE TYPE  ATTRIBUTE VALUE
85 Interface Stability     Committed
87 MT-Level        MT-Safe
89 Standard        See \fBstandards\fR(5).
90 .TE
92 .SH SEE ALSO
93 .sp
94 .LP
95 \fBsem_init\fR(3C), \fBsem_open\fR(3C), \fBsem_unlink\fR(3C),
96 \fBattributes\fR(5), \fBstandards\fR(5)
97 .SH NOTES
98 .sp
99 .LP
100 Solaris 2.6 was the first release to support the Asynchronous Input and Output
101 option. Prior to this release, this function always returned \fB\(mi1\fR and
102 set \fBerrno\fR to \fBENOSYS\fR.