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

DESCRIPTION

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

RETURN VALUE

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

ERRORS

42       The fdetach() function shall fail if:
43
44       EACCES Search permission is denied on a component of the path prefix.
45
46       EINVAL The path argument names a file that is not currently attached.
47
48       ELOOP  A loop exists in symbolic links encountered during resolution of
49              the path argument.
50
51       ENAMETOOLONG
52              The  length  of  a  component  of  a  pathname  is  longer  than
53              {NAME_MAX}.
54
55       ENOENT A component of path does not name an existing file or path is an
56              empty string.
57
58       ENOTDIR
59              A  component  of  the path prefix names an existing file that is
60              neither a directory nor a symbolic link to a directory,  or  the
61              path  argument  contains  at least one non-<slash> character and
62              ends with one or more trailing <slash> characters and  the  last
63              pathname  component  names  an  existing  file that is neither a
64              directory nor a symbolic link to a directory.
65
66       EPERM  The effective user ID is not the owner of path and  the  process
67              does not have appropriate privileges.
68
69       The fdetach() function may fail if:
70
71       ELOOP  More  than  {SYMLOOP_MAX} symbolic links were encountered during
72              resolution of the path argument.
73
74       ENAMETOOLONG
75              The length of a pathname exceeds {PATH_MAX}, or pathname resolu‐
76              tion  of  a symbolic link produced an intermediate result with a
77              length that exceeds {PATH_MAX}.
78
79       The following sections are informative.
80

EXAMPLES

82   Detaching a File
83       The following example detaches the STREAMS-based file /tmp/named-STREAM
84       from  the  file to which it was attached by a previous, successful call
85       to fattach().  Subsequent calls to open this file refer to the underly‐
86       ing file, not to the STREAMS file.
87
88
89           #include <stropts.h>
90           ...
91               char *pathname = "/tmp/named-STREAM";
92               int ret;
93
94               ret = fdetach(pathname);
95

APPLICATION USAGE

97       None.
98

RATIONALE

100       None.
101

FUTURE DIRECTIONS

103       The fdetach() function may be removed in a future version.
104

SEE ALSO

106       fattach()
107
108       The Base Definitions volume of POSIX.1‐2017, <stropts.h>
109
111       Portions  of  this text are reprinted and reproduced in electronic form
112       from IEEE Std 1003.1-2017, Standard for Information Technology --  Por‐
113       table  Operating System Interface (POSIX), The Open Group Base Specifi‐
114       cations Issue 7, 2018 Edition, Copyright (C) 2018 by the  Institute  of
115       Electrical  and  Electronics Engineers, Inc and The Open Group.  In the
116       event of any discrepancy between this version and the original IEEE and
117       The  Open Group Standard, the original IEEE and The Open Group Standard
118       is the referee document. The original Standard can be  obtained  online
119       at http://www.opengroup.org/unix/online.html .
120
121       Any  typographical  or  formatting  errors that appear in this page are
122       most likely to have been introduced during the conversion of the source
123       files  to  man page format. To report such errors, see https://www.ker
124       nel.org/doc/man-pages/reporting_bugs.html .
125
126
127
128IEEE/The Open Group                  2017                          FDETACH(3P)
Impressum