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

NAME

6       fdetach - detach a name from a STREAMS-based file descriptor (STREAMS)
7

SYNOPSIS

9       #include <stropts.h>
10
11       int fdetach(const char *path);
12
13

DESCRIPTION

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

RETURN VALUE

33       Upon successful completion, fdetach() shall  return  0;  otherwise,  it
34       shall return -1 and set errno to indicate the error.
35

ERRORS

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

EXAMPLES

73   Detaching a File
74       The following example detaches the STREAMS-based file /tmp/named-STREAM
75       from the file to which it was attached by a previous,  successful  call
76       to  fattach(). Subsequent calls to open this file refer to the underly‐
77       ing file, not to the STREAMS file.
78
79
80              #include <stropts.h>
81              ...
82                  char *filename = "/tmp/named-STREAM";
83                  int ret;
84
85
86                  ret = fdetach(filename);
87

APPLICATION USAGE

89       None.
90

RATIONALE

92       None.
93

FUTURE DIRECTIONS

95       None.
96

SEE ALSO

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