1FDETACH(3P)                POSIX Programmer's Manual               FDETACH(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       fdetach - detach a name from a STREAMS-based file descriptor (STREAMS)
13

SYNOPSIS

15       #include <stropts.h>
16
17       int fdetach(const char *path);
18
19

DESCRIPTION

21       The fdetach() function shall detach a STREAMS-based file from the  file
22       to  which  it  was  attached by a previous call to fattach().  The path
23       argument points to the pathname  of  the  attached  STREAMS  file.  The
24       process  shall have appropriate privileges or be the owner of the file.
25       A successful call to fdetach() shall cause all pathnames that named the
26       attached  STREAMS file to again name the file to which the STREAMS file
27       was attached. All subsequent operations on path shall  operate  on  the
28       underlying file and not on the STREAMS file.
29
30       All  open  file  descriptions  established  while  the STREAMS file was
31       attached to the file referenced  by  path  shall  still  refer  to  the
32       STREAMS file after the fdetach() has taken effect.
33
34       If  there  are  no  open  file  descriptors  or other references to the
35       STREAMS file, then a successful call to fdetach() shall  be  equivalent
36       to performing the last close() on the attached file.
37

RETURN VALUE

39       Upon  successful  completion,  fdetach()  shall return 0; otherwise, it
40       shall return -1 and set errno to indicate the error.
41

ERRORS

43       The fdetach() function shall fail if:
44
45       EACCES Search permission is denied on a component of the path prefix.
46
47       EINVAL The path argument names a file that is not currently attached.
48
49       ELOOP  A loop exists in symbolic links encountered during resolution of
50              the path argument.
51
52       ENAMETOOLONG
53              The  size  of a pathname exceeds {PATH_MAX} or a pathname compo‐
54              nent is longer than {NAME_MAX}.
55
56       ENOENT A component of path does not name an existing file or path is an
57              empty string.
58
59       ENOTDIR
60              A component of the path prefix is not a directory.
61
62       EPERM  The  effective  user ID is not the owner of path and the process
63              does not have appropriate privileges.
64
65
66       The fdetach() function may fail if:
67
68       ELOOP  More than {SYMLOOP_MAX} symbolic links were  encountered  during
69              resolution of the path argument.
70
71       ENAMETOOLONG
72              Pathname  resolution of a symbolic link produced an intermediate
73              result whose length exceeds {PATH_MAX}.
74
75
76       The following sections are informative.
77

EXAMPLES

79   Detaching a File
80       The following example detaches the STREAMS-based file /tmp/named-STREAM
81       from  the  file to which it was attached by a previous, successful call
82       to