fdetach(3C) fdetach(3C)
NAME
fdetach - detach a name from a STREAMS-based file descriptor
SYNOPSIS
#include <stropts.h>
int fdetach(const char *path);
DESCRIPTION
The fdetach() routine detaches a STREAMS-based file descriptor from a
name in the file system. path is the path name of the object in the
file system name space, which was previously attached [see
fattach(3C)]. The user must be the owner of the file or a user with
the appropriate privileges. All subsequent operations on path will
operate on the file system node and not on the STREAMS file. The per-
missions and status of the node are restored to the state the node was
in before the STREAMS file was attached to it.
All open file descriptions established while the STREAMS file was
attached to the file referenced by path, will still refer to the
STREAMS file after the fdetach() has taken effect.
If there are no open file descriptors or other references to the
STREAMS file, then a successful call to fdetach() has the same effect
as performing the last close() on the attached file.
RETURN VALUE
If successful, fdetach() returns 0; otherwise it returns -1 and sets
errno to indicate an error.
ERRORS
The following error code descriptions are function-specific. You will
find a general description in introprm2(2) or in errno(5).
Under the following conditions, the function fdetach fails and sets
errno to:
EACCES Search permission is denied on a component of the path
prefix.
EPERM The effective user ID is not the owner of path or is not
a user with appropriate permissions.
ENOTDIR A component of the path prefix is not a directory.
ENOENT path does not exist.
EINVAL path is not attached to a STREAMS file.
ENAMETOOLONG The size of path exceeds PATHMAX, or a path name com-
ponent is longer than NAMEMAX while POSIXNOTRUNC is
in effect.
Page 1 Reliant UNIX 5.44 Printed 11/98
fdetach(3C) fdetach(3C)
ELOOP Too many symbolic links were encountered in translating
path.
The fdetach() function may fail if:
ENAMETOOLONG Pathname resolution of a symbolic link produced an
intermediate result whose length exceeds PATHMAX.
SEE ALSO
fdetach(1M), fattach(3C), stropts(5), streamio(7).
Page 2 Reliant UNIX 5.44 Printed 11/98