Blame man-pages-posix-2013-a/man3p/fdetach.3p

Packit 7cfc04
'\" et
Packit 7cfc04
.TH FDETACH "3P" 2013 "IEEE/The Open Group" "POSIX Programmer's Manual"
Packit 7cfc04
.SH PROLOG
Packit 7cfc04
This manual page is part of the POSIX Programmer's Manual.
Packit 7cfc04
The Linux implementation of this interface may differ (consult
Packit 7cfc04
the corresponding Linux manual page for details of Linux behavior),
Packit 7cfc04
or the interface may not be implemented on Linux.
Packit 7cfc04
Packit 7cfc04
.SH NAME
Packit 7cfc04
fdetach
Packit 7cfc04
\(em detach a name from a STREAMS-based file descriptor (\fBSTREAMS\fP)
Packit 7cfc04
.SH SYNOPSIS
Packit 7cfc04
.LP
Packit 7cfc04
.nf
Packit 7cfc04
#include <stropts.h>
Packit 7cfc04
.P
Packit 7cfc04
int fdetach(const char *\fIpath\fP);
Packit 7cfc04
.fi
Packit 7cfc04
.SH DESCRIPTION
Packit 7cfc04
The
Packit 7cfc04
\fIfdetach\fR()
Packit 7cfc04
function shall detach a STREAMS-based file from the file to which
Packit 7cfc04
it was attached by a previous call to
Packit 7cfc04
\fIfattach\fR().
Packit 7cfc04
The
Packit 7cfc04
.IR path
Packit 7cfc04
argument points to the pathname of the attached STREAMS file. The
Packit 7cfc04
process shall have appropriate privileges or be the owner of the file.
Packit 7cfc04
A successful call to
Packit 7cfc04
\fIfdetach\fR()
Packit 7cfc04
shall cause all pathnames that named the attached STREAMS file to again
Packit 7cfc04
name the file to which the STREAMS file was attached. All subsequent
Packit 7cfc04
operations on
Packit 7cfc04
.IR path
Packit 7cfc04
shall operate on the underlying file and not on the STREAMS file.
Packit 7cfc04
.P
Packit 7cfc04
All open file descriptions established while the STREAMS file was
Packit 7cfc04
attached to the file referenced by
Packit 7cfc04
.IR path
Packit 7cfc04
shall still refer to the STREAMS file after the
Packit 7cfc04
\fIfdetach\fR()
Packit 7cfc04
has taken effect.
Packit 7cfc04
.P
Packit 7cfc04
If there are no open file descriptors or other references to the
Packit 7cfc04
STREAMS file, then a successful call to
Packit 7cfc04
\fIfdetach\fR()
Packit 7cfc04
shall be equivalent to performing the last
Packit 7cfc04
\fIclose\fR()
Packit 7cfc04
on the attached file.
Packit 7cfc04
.SH "RETURN VALUE"
Packit 7cfc04
Upon successful completion,
Packit 7cfc04
\fIfdetach\fR()
Packit 7cfc04
shall return 0; otherwise, it shall return \(mi1 and set
Packit 7cfc04
.IR errno
Packit 7cfc04
to indicate the error.
Packit 7cfc04
.SH ERRORS
Packit 7cfc04
The
Packit 7cfc04
\fIfdetach\fR()
Packit 7cfc04
function shall fail if:
Packit 7cfc04
.TP
Packit 7cfc04
.BR EACCES
Packit 7cfc04
Search permission is denied on a component of the path prefix.
Packit 7cfc04
.TP
Packit 7cfc04
.BR EINVAL
Packit 7cfc04
The
Packit 7cfc04
.IR path
Packit 7cfc04
argument names a file that is not currently attached.
Packit 7cfc04
.TP
Packit 7cfc04
.BR ELOOP
Packit 7cfc04
A loop exists in symbolic links encountered during resolution of the
Packit 7cfc04
.IR path
Packit 7cfc04
argument.
Packit 7cfc04
.TP
Packit 7cfc04
.BR ENAMETOOLONG
Packit 7cfc04
.br
Packit 7cfc04
The length of a component of a pathname is longer than
Packit 7cfc04
{NAME_MAX}.
Packit 7cfc04
.TP
Packit 7cfc04
.BR ENOENT
Packit 7cfc04
A component of
Packit 7cfc04
.IR path
Packit 7cfc04
does not name an existing file or
Packit 7cfc04
.IR path
Packit 7cfc04
is an empty string.
Packit 7cfc04
.TP
Packit 7cfc04
.BR ENOTDIR
Packit 7cfc04
A component of the path prefix names an existing file that is neither
Packit 7cfc04
a directory nor a symbolic link to a directory, or the
Packit 7cfc04
.IR path
Packit 7cfc04
argument contains at least one non-\c
Packit 7cfc04
<slash>
Packit 7cfc04
character and ends with one or more trailing
Packit 7cfc04
<slash>
Packit 7cfc04
characters and the last pathname component names an existing file
Packit 7cfc04
that is neither a directory nor a symbolic link to a directory.
Packit 7cfc04
.TP
Packit 7cfc04
.BR EPERM
Packit 7cfc04
The effective user ID is not the owner of
Packit 7cfc04
.IR path
Packit 7cfc04
and the process does not have appropriate privileges.
Packit 7cfc04
.P
Packit 7cfc04
The
Packit 7cfc04
\fIfdetach\fR()
Packit 7cfc04
function may fail if:
Packit 7cfc04
.TP
Packit 7cfc04
.BR ELOOP
Packit 7cfc04
More than
Packit 7cfc04
{SYMLOOP_MAX}
Packit 7cfc04
symbolic links were encountered during resolution of the
Packit 7cfc04
.IR path
Packit 7cfc04
argument.
Packit 7cfc04
.TP
Packit 7cfc04
.BR ENAMETOOLONG
Packit 7cfc04
.br
Packit 7cfc04
The length of a pathname exceeds
Packit 7cfc04
{PATH_MAX},
Packit 7cfc04
or pathname resolution of a symbolic link produced an intermediate
Packit 7cfc04
result with a length that exceeds
Packit 7cfc04
{PATH_MAX}.
Packit 7cfc04
.LP
Packit 7cfc04
.IR "The following sections are informative."
Packit 7cfc04
.SH EXAMPLES
Packit 7cfc04
.SS "Detaching a File"
Packit 7cfc04
.P
Packit 7cfc04
The following example detaches the STREAMS-based file
Packit 7cfc04
.BR /tmp/named-STREAM
Packit 7cfc04
from the file to which it was attached by a previous, successful call
Packit 7cfc04
to
Packit 7cfc04
\fIfattach\fR().
Packit 7cfc04
Subsequent calls to open this file refer to the underlying file, not to
Packit 7cfc04
the STREAMS file.
Packit 7cfc04
.sp
Packit 7cfc04
.RS 4
Packit 7cfc04
.nf
Packit 7cfc04
\fB
Packit 7cfc04
#include <stropts.h>
Packit 7cfc04
\&...
Packit 7cfc04
    char *pathname = "/tmp/named-STREAM";
Packit 7cfc04
    int ret;
Packit 7cfc04
.P
Packit 7cfc04
    ret = fdetach(pathname);
Packit 7cfc04
.fi \fR
Packit 7cfc04
.P
Packit 7cfc04
.RE
Packit 7cfc04
.SH "APPLICATION USAGE"
Packit 7cfc04
None.
Packit 7cfc04
.SH RATIONALE
Packit 7cfc04
None.
Packit 7cfc04
.SH "FUTURE DIRECTIONS"
Packit 7cfc04
The
Packit 7cfc04
\fIfdetach\fR()
Packit 7cfc04
function may be removed in a future version.
Packit 7cfc04
.SH "SEE ALSO"
Packit 7cfc04
.IR "\fIfattach\fR\^(\|)"
Packit 7cfc04
.P
Packit 7cfc04
The Base Definitions volume of POSIX.1\(hy2008,
Packit 7cfc04
.IR "\fB<stropts.h>\fP"
Packit 7cfc04
.SH COPYRIGHT
Packit 7cfc04
Portions of this text are reprinted and reproduced in electronic form
Packit 7cfc04
from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
Packit 7cfc04
-- Portable Operating System Interface (POSIX), The Open Group Base
Packit 7cfc04
Specifications Issue 7, Copyright (C) 2013 by the Institute of
Packit 7cfc04
Electrical and Electronics Engineers, Inc and The Open Group.
Packit 7cfc04
(This is POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
Packit 7cfc04
event of any discrepancy between this version and the original IEEE and
Packit 7cfc04
The Open Group Standard, the original IEEE and The Open Group Standard
Packit 7cfc04
is the referee document. The original Standard can be obtained online at
Packit 7cfc04
http://www.unix.org/online.html .
Packit 7cfc04
Packit 7cfc04
Any typographical or formatting errors that appear
Packit 7cfc04
in this page are most likely
Packit 7cfc04
to have been introduced during the conversion of the source files to
Packit 7cfc04
man page format. To report such errors, see
Packit 7cfc04
https://www.kernel.org/doc/man-pages/reporting_bugs.html .