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 fattach(). Subsequent calls to open this file refer to the  underly‐
83       ing file, not to the STREAMS file.
84
85
86              #include <stropts.h>
87              ...
88                  char *filename = "/tmp/named-STREAM";
89                  int ret;
90
91
92                  ret = fdetach(filename);
93

APPLICATION USAGE

95       None.
96

RATIONALE

98       None.
99

FUTURE DIRECTIONS

101       None.
102

SEE ALSO

104       fattach(),   the   Base  Definitions  volume  of  IEEE Std 1003.1-2001,
105       <stropts.h>
106
108       Portions of this text are reprinted and reproduced in  electronic  form
109       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
110       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
111       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
112       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
113       event of any discrepancy between this version and the original IEEE and
114       The Open Group Standard, the original IEEE and The Open Group  Standard
115       is  the  referee document. The original Standard can be obtained online
116       at http://www.opengroup.org/unix/online.html .
117
118
119
120IEEE/The Open Group                  2003                          FDETACH(3P)
Impressum