Unleashed v1.4
[unleashed.git] / share / man / man3c / fdetach.3c
blobdc56d76f9bcf3db0de5d10fcc88b1a36be319936
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Copyright 1989 AT&T
44 .\" Portions Copyright (c) 1992, X/Open Company Limited  All Rights Reserved
45 .\" Copyright (c) 2002, Sun Microsystems, Inc.  All Rights Reserved.
46 .\"
47 .TH FDETACH 3C "Jul 24, 2002"
48 .SH NAME
49 fdetach \- detach a name from a STREAMS-based file descriptor
50 .SH SYNOPSIS
51 .LP
52 .nf
53 #include <stropts.h>
55 \fBint\fR \fBfdetach\fR(\fBconst char *\fR\fIpath\fR);
56 .fi
58 .SH DESCRIPTION
59 .sp
60 .LP
61 The \fBfdetach()\fR function detaches a STREAMS-based file from the file to
62 which it was attached by a previous call to \fBfattach\fR(3C). The \fIpath\fR
63 argument points to the pathname of the attached \fBSTREAMS\fR file. The process
64 must have appropriate privileges or be the owner of the file. A successful call
65 to \fBfdetach()\fR causes all pathnames that named the attached \fBSTREAMS\fR
66 file to again name the file to which the \fBSTREAMS\fR file was attached.  All
67 subsequent operations on \fIpath\fR will operate on the underlying file and not
68 on the \fBSTREAMS\fR file.
69 .sp
70 .LP
71 All open file descriptions established while the \fBSTREAMS\fR file was
72 attached to the file referenced by \fIpath\fR, will still refer to the
73 \fBSTREAMS\fR file after the \fBfdetach()\fR has taken effect.
74 .sp
75 .LP
76 If there are no open file descriptors or other references to the \fBSTREAMS\fR
77 file, then a successful call to \fBfdetach()\fR has the same effect as
78 performing the last \fBclose\fR(2) on the attached file.
79 .SH RETURN VALUES
80 .sp
81 .LP
82 Upon successful completion, \fBfdetach()\fR returns \fB0\fR. Otherwise, it
83 returns \fB\(mi1\fR and sets \fBerrno\fR to indicate the error.
84 .SH ERRORS
85 .sp
86 .LP
87 The \fBfdetach()\fR function will fail if:
88 .sp
89 .ne 2
90 .na
91 \fB\fBEACCES\fR\fR
92 .ad
93 .RS 16n
94 Search permission is denied on a component of the path prefix.
95 .RE
97 .sp
98 .ne 2
99 .na
100 \fB\fBEPERM\fR\fR
102 .RS 16n
103 The effective user \fBID\fR is not the owner of \fIpath\fR and the process does
104 not have appropriate privileges.
108 .ne 2
110 \fB\fBENOTDIR\fR\fR
112 .RS 16n
113 A component of the path prefix is not a directory.
117 .ne 2
119 \fB\fBENOENT\fR\fR
121 .RS 16n
122 A component of \fIpath\fR does not name an existing file or \fIpath\fR is an
123 empty string.
127 .ne 2
129 \fB\fBEINVAL\fR\fR
131 .RS 16n
132 The \fIpath\fR argument names a file that is not currently attached.
136 .ne 2
138 \fB\fBENAMETOOLONG\fR\fR
140 .RS 16n
141 The size of a pathname exceeds \fBPATH_MAX\fR, or a pathname component is
142 longer than \fBNAME_MAX\fR while \fB_POSIX_NO_TRUNC\fR is in effect.
146 .ne 2
148 \fB\fBELOOP\fR\fR
150 .RS 16n
151 Too many symbolic links were encountered in resolving \fIpath\fR.
156 The \fBfdetach()\fR function may fail if:
158 .ne 2
160 \fB\fBENAMETOOLONG\fR\fR
162 .RS 16n
163 Pathname resolution of a symbolic link produced an intermediate result whose
164 length exceeds \fBPATH_MAX\fR.
167 .SH ATTRIBUTES
170 See \fBattributes\fR(5) for descriptions of the following attributes:
175 box;
176 l | l
177 l | l .
178 ATTRIBUTE TYPE  ATTRIBUTE VALUE
180 Interface Stability     Standard
183 .SH SEE ALSO
186 \fBfdetach\fR(8), \fBclose\fR(2), \fBfattach\fR(3C), \fBattributes\fR(5),
187 \fBstandards\fR(5), \fBstreamio\fR(7I)
190 \fISTREAMS Programming Guide\fR