194 lines
6.3 KiB
HTML
194 lines
6.3 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
|
|
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
|
|
<title>fdetach</title>
|
|
</head>
|
|
<body bgcolor="white">
|
|
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
|
|
</script>
|
|
|
|
<basefont size="3"> <a name="fdetach"></a> <a name="tag_03_144"></a><!-- fdetach -->
|
|
<!--header start-->
|
|
<center><font size="2">The Open Group Base Specifications Issue 6<br>
|
|
IEEE Std 1003.1-2001<br>
|
|
Copyright © 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
|
|
|
|
<!--header end-->
|
|
<hr size="2" noshade>
|
|
<h4><a name="tag_03_144_01"></a>NAME</h4>
|
|
|
|
<blockquote>fdetach - detach a name from a STREAMS-based file descriptor (<b>STREAMS</b>)</blockquote>
|
|
|
|
<h4><a name="tag_03_144_02"></a>SYNOPSIS</h4>
|
|
|
|
<blockquote class="synopsis">
|
|
<div class="box"><code><tt><sup>[<a href="javascript:open_code('XSR')">XSR</a>]</sup> <img src="../images/opt-start.gif" alt=
|
|
"[Option Start]" border="0"> #include <<a href="../basedefs/stropts.h.html">stropts.h</a>><br>
|
|
<br>
|
|
int fdetach(const char *</tt><i>path</i><tt>); <img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div>
|
|
|
|
<tt><br>
|
|
</tt></blockquote>
|
|
|
|
<h4><a name="tag_03_144_03"></a>DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>fdetach</i>() function shall detach a STREAMS-based file from the file to which it was attached by a previous call to <a
|
|
href="../functions/fattach.html"><i>fattach</i>()</a>. The <i>path</i> argument points to the pathname of the attached STREAMS
|
|
file. The process shall have appropriate privileges or be the owner of the file. A successful call to <i>fdetach</i>() shall cause
|
|
all pathnames that named the attached STREAMS file to again name the file to which the STREAMS file was attached. All subsequent
|
|
operations on <i>path</i> shall operate on the underlying file and not on the STREAMS file.</p>
|
|
|
|
<p>All open file descriptions established while the STREAMS file was attached to the file referenced by <i>path</i> shall still
|
|
refer to the STREAMS file after the <i>fdetach</i>() has taken effect.</p>
|
|
|
|
<p>If there are no open file descriptors or other references to the STREAMS file, then a successful call to <i>fdetach</i>() shall
|
|
be equivalent to performing the last <a href="../functions/close.html"><i>close</i>()</a> on the attached file.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_144_04"></a>RETURN VALUE</h4>
|
|
|
|
<blockquote>
|
|
<p>Upon successful completion, <i>fdetach</i>() shall return 0; otherwise, it shall return -1 and set <i>errno</i> to indicate the
|
|
error.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_144_05"></a>ERRORS</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>fdetach</i>() function shall fail if:</p>
|
|
|
|
<dl compact>
|
|
<dt>[EACCES]</dt>
|
|
|
|
<dd>Search permission is denied on a component of the path prefix.</dd>
|
|
|
|
<dt>[EINVAL]</dt>
|
|
|
|
<dd>The <i>path</i> argument names a file that is not currently attached.</dd>
|
|
|
|
<dt>[ELOOP]</dt>
|
|
|
|
<dd>A loop exists in symbolic links encountered during resolution of the <i>path</i> argument.</dd>
|
|
|
|
<dt>[ENAMETOOLONG]</dt>
|
|
|
|
<dd>
|
|
The size of a pathname exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX}.</dd>
|
|
|
|
<dt>[ENOENT]</dt>
|
|
|
|
<dd>A component of <i>path</i> does not name an existing file or <i>path</i> is an empty string.</dd>
|
|
|
|
<dt>[ENOTDIR]</dt>
|
|
|
|
<dd>A component of the path prefix is not a directory.</dd>
|
|
|
|
<dt>[EPERM]</dt>
|
|
|
|
<dd>The effective user ID is not the owner of <i>path</i> and the process does not have appropriate privileges.</dd>
|
|
</dl>
|
|
|
|
<p>The <i>fdetach</i>() function may fail if:</p>
|
|
|
|
<dl compact>
|
|
<dt>[ELOOP]</dt>
|
|
|
|
<dd>More than {SYMLOOP_MAX} symbolic links were encountered during resolution of the <i>path</i> argument.</dd>
|
|
|
|
<dt>[ENAMETOOLONG]</dt>
|
|
|
|
<dd>
|
|
Pathname resolution of a symbolic link produced an intermediate result whose length exceeds {PATH_MAX}.</dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<hr>
|
|
<div class="box"><em>The following sections are informative.</em></div>
|
|
|
|
<h4><a name="tag_03_144_06"></a>EXAMPLES</h4>
|
|
|
|
<blockquote>
|
|
<h5><a name="tag_03_144_06_01"></a>Detaching a File</h5>
|
|
|
|
<p>The following example detaches the STREAMS-based file <b>/tmp/named-STREAM</b> from the file to which it was attached by a
|
|
previous, successful call to <a href="../functions/fattach.html"><i>fattach</i>()</a>. Subsequent calls to open this file refer to
|
|
the underlying file, not to the STREAMS file.</p>
|
|
|
|
<pre>
|
|
<tt>#include <stropts.h>
|
|
...
|
|
char *filename = "/tmp/named-STREAM";
|
|
int ret;
|
|
<br>
|
|
ret = fdetach(filename);
|
|
</tt>
|
|
</pre>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_144_07"></a>APPLICATION USAGE</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_144_08"></a>RATIONALE</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_144_09"></a>FUTURE DIRECTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_144_10"></a>SEE ALSO</h4>
|
|
|
|
<blockquote>
|
|
<p><a href="fattach.html"><i>fattach</i>()</a> , the Base Definitions volume of IEEE Std 1003.1-2001, <a href=
|
|
"../basedefs/stropts.h.html"><i><stropts.h></i></a></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_144_11"></a>CHANGE HISTORY</h4>
|
|
|
|
<blockquote>
|
|
<p>First released in Issue 4, Version 2.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_144_12"></a>Issue 5</h4>
|
|
|
|
<blockquote>
|
|
<p>Moved from X/OPEN UNIX extension to BASE.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_144_13"></a>Issue 6</h4>
|
|
|
|
<blockquote>
|
|
<p>The DESCRIPTION is updated to avoid use of the term "must" for application requirements.</p>
|
|
|
|
<p>The wording of the mandatory [ELOOP] error condition is updated, and a second optional [ELOOP] error condition is added.</p>
|
|
</blockquote>
|
|
|
|
<div class="box"><em>End of informative text.</em></div>
|
|
|
|
<hr>
|
|
<hr size="2" noshade>
|
|
<center><font size="2"><!--footer start-->
|
|
UNIX ® is a registered Trademark of The Open Group.<br>
|
|
POSIX ® is a registered Trademark of The IEEE.<br>
|
|
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
|
|
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
|
|
]</font></center>
|
|
|
|
<!--footer end-->
|
|
<hr size="2" noshade>
|
|
</body>
|
|
</html>
|
|
|