1FDETACH(3P) POSIX Programmer's Manual FDETACH(3P)
2
3
4
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
11
13 fdetach — detach a name from a STREAMS-based file descriptor (STREAMS)
14
16 #include <stropts.h>
17
18 int fdetach(const char *path);
19
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
39 Upon successful completion, fdetach() shall return 0; otherwise, it
40 shall return −1 and set errno to indicate the error.
41
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 length of a component of a pathname is longer than
54 {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 names an existing file that is
61 neither a directory nor a symbolic link to a directory, or the
62 path argument contains at least one non-<slash> character and
63 ends with one or more trailing <slash> characters and the last
64 pathname component names an existing file that is neither a
65 directory nor a symbolic link to a directory.
66
67 EPERM The effective user ID is not the owner of path and the process
68 does not have appropriate privileges.
69
70 The fdetach() function may fail if:
71
72 ELOOP More than {SYMLOOP_MAX} symbolic links were encountered during
73 resolution of the path argument.
74
75 ENAMETOOLONG
76 The length of a pathname exceeds {PATH_MAX}, or pathname resolu‐
77 tion of a symbolic link produced an intermediate result with a
78 length that exceeds {PATH_MAX}.
79
80