📄 xcu_chap01.html
字号:
<p class="tent">F</p></td><td align="center"><p class="tent">-</p></td><td align="center"><p class="tent">-</p></td><td align="center"><p class="tent">-</p></td><td align="center"><p class="tent">RF</p></td><td align="center"><p class="tent">-</p></td><td align="center"><p class="tent">-</p></td><td align="left"><p class="tent"><i>open</i>()</p></td></tr><tr valign="top"><td align="left"><p class="tent">S</p></td><td align="left"><p class="tent">Socket</p></td><td align="center"><p class="tent">F</p></td><td align="center"><p class="tent">F</p></td><td align="center"><p class="tent">F</p></td><td align="center"><p class="tent">F</p></td><td align="center"><p class="tent">F</p></td><td align="center"><p class="tent">-</p></td><td align="center"><p class="tent">-</p></td><td align="center"><p class="tent">-</p></td><td align="center"><p class="tent">-</p></td><td align="center"><p class="tent">-</p></td><td align="center"><p class="tent">-</p></td><td align="left"><p class="tent"><i>bind</i>()</p></td></tr><tr valign="top"><td align="left"><p class="tent">T</p></td><td align="left"><p class="tent">Typed Memory</p></td><td align="center"><p class="tent">F</p></td><td align="center"><p class="tent">F</p></td><td align="center"><p class="tent">F</p></td><td align="center"><p class="tent">F</p></td><td align="center"><p class="tent">F</p></td><td align="center"><p class="tent">-</p></td><td align="center"><p class="tent">-</p></td><td align="center"><p class="tent">-</p></td><td align="center"><p class="tent">-</p></td><td align="center"><p class="tent">-</p></td><td align="center"><p class="tent">-</p></td><td align="left"><p class="tent">*</p></td></tr></table></center><p>The following codes are used in <a href="#tagtcjh_1">Actions when Creating a File that Already Exists</a> :</p><dl compact><dt>F</dt><dd>Fail. The attempt to create the new file shall fail and the utility shall either continue with its operation or exitimmediately with a non-zero exit status, depending on the description of the utility.</dd><dt>FL</dt><dd>Follow link. Unless otherwise specified, the symbolic link shall be followed as specified for pathname resolution, and theoperation performed shall be as if the target of the symbolic link (after all resolution) had been named. If the target of thesymbolic link does not exist, it shall be as if that nonexistent target had been named directly.</dd><dt>O</dt><dd>Open FIFO. When attempting to create a regular file, and the existing file is a FIFO special file: <ol><li><p>If the FIFO is not already open for reading, the attempt shall block until the FIFO is opened for reading.</p></li><li><p>Once the FIFO is open for reading, the utility shall open the FIFO for writing and continue with its operation.</p></li></ol></dd><dt>OF</dt><dd>The named file shall be opened with the consequences defined for that file type.</dd><dt>RF</dt><dd>Regular file. When attempting to create a regular file, and the existing file is a regular file: <ol><li><p>The user ID, group ID, and permission bits of the file shall not be changed.</p></li><li><p>The file shall be truncated to zero length.</p></li><li><p>The <i>st_ctime</i> and <i>st_mtime</i> fields shall be marked for update.</p></li></ol></dd><dt>-</dt><dd>The effect is implementation-defined unless specified by the utility description.</dd><dt>*</dt><dd>There is no portable way to create a file of this type.</dd><dt>**</dt><dd>Not portable.</dd></dl><p>When a file is to be appended, the file shall be opened in a manner equivalent to using the O_APPEND flag, without the O_TRUNCflag, in the <a href="../functions/open.html"><i>open</i>()</a> function defined in the System Interfaces volume ofIEEE Std 1003.1-2001.</p><p>When a file is to be read or written, the file shall be opened with an access mode corresponding to the operation to beperformed. If file access permissions deny access, the requested operation shall fail.</p><h5><a name="tag_01_07_01_05"></a>File Removal</h5><p>When a directory that is the root directory or current working directory of any process is removed, the effect isimplementation-defined. If file access permissions deny access, the requested operation shall fail. Otherwise, when a file isremoved:</p><ol><li><p>Its directory entry shall be removed from the file system.</p></li><li><p>The link count of the file shall be decremented.</p></li><li><p>If the file is an empty directory (see the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap03.html#tag_03_143">Section 3.143, Empty Directory</a>):</p><ol type="a"><li><p>If no process has the directory open, the space occupied by the directory shall be freed and the directory shall no longer beaccessible.</p></li><li><p>If one or more processes have the directory open, the directory contents shall be preserved until all references to the filehave been closed.</p></li></ol></li><li><p>If the file is a directory that is not empty, the <i>st_ctime</i> field shall be marked for update.</p></li><li><p>If the file is not a directory:</p><ol type="a"><li><p>If the link count becomes zero:</p><ol type="i"><li><p>If no process has the file open, the space occupied by the file shall be freed and the file shall no longer be accessible.</p></li><li><p>If one or more processes have the file open, the file contents shall be preserved until all references to the file have beenclosed.</p></li></ol></li><li><p>If the link count is not reduced to zero, the <i>st_ctime</i> field shall be marked for update.</p></li></ol></li><li><p>The <i>st_ctime</i> and <i>st_mtime</i> fields of the containing directory shall be marked for update.</p></li></ol><h5><a name="tag_01_07_01_06"></a>File Time Values</h5><p>All files shall have the three time values described by the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap04.html#tag_04_07">Section 4.7, File Times Update</a>.</p><h5><a name="tag_01_07_01_07"></a>File Contents</h5><p>When a reference is made to the contents of a file, <i>pathname</i>, this means the equivalent of all of the data placed in thespace pointed to by <i>buf</i> when performing the <a href="../functions/read.html"><i>read</i>()</a> function calls in thefollowing operations defined in the System Interfaces volume of IEEE Std 1003.1-2001:</p><blockquote><pre><tt>while (read (fildes, buf, nbytes) > 0) ;</tt></pre></blockquote><p>If the file is indicated by a pathname <i>pathname</i>, the file descriptor shall be determined by the equivalent of thefollowing operation defined in the System Interfaces volume of IEEE Std 1003.1-2001:</p><blockquote><pre><tt>fildes = open (pathname, O_RDONLY);</tt></pre></blockquote><p>The value of <i>nbytes</i> in the above sequence is unspecified; if the file is of a type where the data returned by <a href="../functions/read.html"><i>read</i>()</a> would vary with different values, the value shall be one that results in the most databeing returned.</p><p>If the <a href="../functions/read.html"><i>read</i>()</a> function calls would return an error, it is unspecified whether thecontents of the file are considered to include any data from offsets in the file beyond where the error would be returned.</p><h5><a name="tag_01_07_01_08"></a>Pathname Resolution</h5><p>The pathname resolution algorithm, described by the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap04.html#tag_04_11">Section 4.11, Pathname Resolution</a>, shall be used by implementations conforming to thisvolume of IEEE Std 1003.1-2001; see also the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap04.html#tag_04_05">Section 4.5, File Hierarchy</a>.</p><h5><a name="tag_01_07_01_09"></a>Changing the Current Working Directory</h5><p>When the current working directory (see the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap03.html#tag_03_436">Section 3.436, Working Directory</a>) is to be changed, unless the utility or functiondescription states otherwise, the operation shall succeed unless a call to the <a href="../functions/chdir.html"><i>chdir</i>()</a>function defined in the System Interfaces volume of IEEE Std 1003.1-2001 would fail when invoked with the new workingdirectory pathname as its argument.</p><h5><a name="tag_01_07_01_10"></a>Establish the Locale</h5><p>The functionality of the <a href="../functions/setlocale.html"><i>setlocale</i>()</a> function defined in the System Interfacesvolume of IEEE Std 1003.1-2001 shall be available on all systems conforming to this volume ofIEEE Std 1003.1-2001; that is, utilities that require the capability of establishing an international operatingenvironment shall be permitted to set the specified category of the international environment.</p><h5><a name="tag_01_07_01_11"></a>Actions Equivalent to Functions</h5><p>Some utility descriptions specify that a utility performs actions equivalent to a function defined in the System Interfacesvolume of IEEE Std 1003.1-2001. Such specifications require only that the external effects be equivalent, not that anyeffect within the utility and visible only to the utility be equivalent.</p><h4><a name="tag_01_07_02"></a>Concepts Derived from the ISO C Standard</h4><p>Some of the standard utilities perform complex data manipulation using their own procedure and arithmetic languages, as definedin their EXTENDED DESCRIPTION or OPERANDS sections. Unless otherwise noted, the arithmetic and semantic concepts (precision, typeconversion, control flow, and so on) shall be equivalent to those defined in the ISO C standard, as described in the followingsections. Note that there is no requirement that the standard utilities be implemented in any particular programming language.</p><h5><a name="tag_01_07_02_01"></a>Arithmetic Precision and Operations</h5><p>Integer variables and constants, including the values of operands and option-arguments, used by the standard utilities listed inthis volume of IEEE Std 1003.1-2001 shall be implemented as equivalent to the ISO C standard <b>signed long</b> datatype; floating point shall be implemented as equivalent to the ISO C standard <b>double</b> type. Conversions between typesshall be as described in the ISO C standard. All variables shall be initialized to zero if they are not otherwise assigned bythe input to the application.</p><p>Arithmetic operators and control flow keywords shall be implemented as equivalent to those in the cited ISO C standardsection, as listed in <a href="#tagtcjh_2">Selected ISO C Standard Operators and Control Flow Keywords</a> .</p><hr><center><b><a name="tagtcjh_2"></a> Table: Selected ISO C Standard Operators and Control Flow Keywords</b></center><center><table border="1" cellpadding="3" align="center"><tr valign="top"><th align="center"><p class="tent"><b>Operation</b></p></th><th align="center"><p class="tent"><b>ISO C Standard Equivalent Reference</b></p></th></tr><tr valign="top"><td align="left"><p class="tent">()</p></td><td align="left"><p class="tent">Section 6.5.1, Primary Expressions</p></td></tr><tr valign="top"><td align="left"><p class="tent">postfix ++</p></td><td align="left"><p class="tent">Section 6.5.2, Postfix Operators</p></td></tr>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -