'\"macro stdmacro
.if n .pH g3c.fdetach @(#)fdetach	40.5 of 10/10/89
.\" Copyright 1989 AT&T
.nr X
.if \nX=0 .ds x} fdetach 3C "" "\&"
.if \nX=1 .ds x} fdetach 3C ""
.if \nX=2 .ds x} fdetach 3C "" "\&"
.if \nX=3 .ds x} fdetach "" "" "\&"
.TH \*(x}
.SH NAME
\f4fdetach\fP \- detach a name from a \s-1STREAMS\s+1-based file descriptor
.SH SYNOPSIS
.nf
\f4int fdetach(const char *path);\f1
.fi
.SH DESCRIPTION
The \f4fdetach\f1 routine detaches a \s-1STREAMS\s+1-based file descriptor from
a name in the file system.
\f2path\f1 is the path name of the object in the file system name space,
which was previously attached [see \f4fattach\f1(3C)]. 
The user must be the owner of the file or a user with the appropriate privileges.
All subsequent operations on \f2path\f1 will operate on the file system node
and not on the \s-1STREAMS\s+1 file.
The permissions and status of the node are restored to the state the node was
in before the \s-1STREAMS\s+1 file was attached to it.
.SH "RETURN VALUE"
If successful, \f4fdetach\f1 returns 0; otherwise it returns -1 and sets
\f4errno\f1 to indicate an error.
.SH ERRORS
Under the following conditions, the function \f4fdetach\f1 fails and 
sets \f4errno\f1 to:
.TP 13
\f4EPERM\fP
The effective user \s-1ID\s+1 is not the owner of \f2path\f1 or is
not a user with appropriate permissions.
.TP 13
\f4ENOTDIR\fP
A component of the path prefix is not a directory.
.TP 13
\f4ENOENT\fP
\f2path\f1 does not exist.
.TP 13
\f4EINVAL\fP
\f2path\f1 is not attached to a \s-1STREAMS\s0 file.
.TP 13
\f4ENAMETOOLONG\fP
The size of \f2path\f1 exceeds \f4{PATH_MAX}\fP, or a path name component 
is longer than \f4{NAME_MAX}\fP while \f4{_POSIX_NO_TRUNC}\fP is in effect.
.TP 13
\f4ELOOP\fP
Too many symbolic links were encountered in translating \f2path\f1.
.SH "SEE ALSO"
\f4fdetach\f1(1M), \f4fattach\fP(3C), \f4streamio\fP(7).
.br
in the \f2Programmer's Guide: \s-1STREAMS\s+1\f1
.Ee
