⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xsh_chap02_02.html

📁 IEEE 1003.1-2003, Single Unix Specification v3
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<!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-2003 The Open Group, All Rights Reserved --><title>System Interfaces Chapter 2</title></head><body><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1-2001</font></center><hr size="2" noshade><h3><a name="tag_02_02"></a>The Compilation Environment</h3><h4><a name="tag_02_02_01"></a>POSIX.1 Symbols</h4><p>Certain symbols in this volume of IEEE&nbsp;Std&nbsp;1003.1-2001 are defined in headers (see the Base Definitions volume ofIEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/xbd_chap13.html#tag_13">Chapter 13, Headers</a>). Some of those headers couldalso define symbols other than those defined by IEEE&nbsp;Std&nbsp;1003.1-2001, potentially conflicting with symbols used by theapplication. Also, IEEE&nbsp;Std&nbsp;1003.1-2001 defines symbols that are not permitted by other standards to appear in thoseheaders without some control on the visibility of those symbols.</p><p>Symbols called &quot;feature test macros&quot; are used to control the visibility of symbols that might be included in a header.Implementations, future versions of IEEE&nbsp;Std&nbsp;1003.1-2001, and other standards may define additional feature testmacros.</p><p>In the compilation of an application that <b>#define</b>s a feature test macro specified by IEEE&nbsp;Std&nbsp;1003.1-2001, noheader defined by IEEE&nbsp;Std&nbsp;1003.1-2001 shall be included prior to the definition of the feature test macro. Thisrestriction also applies to any implementation-provided header in which these feature test macros are used. If the definition ofthe macro does not precede the <b>#include</b>, the result is undefined.</p><p>Feature test macros shall begin with the underscore character ( <tt>'_'</tt> ).</p><h5><a name="tag_02_02_01_01"></a>The _POSIX_C_SOURCE Feature Test Macro</h5><p>A POSIX-conforming application should ensure that the feature test macro _POSIX_C_SOURCE is defined before inclusion of anyheader.</p><p>When an application includes a header described by IEEE&nbsp;Std&nbsp;1003.1-2001, and when this feature test macro is definedto have the value 200112L:</p><ol><li><p>All symbols required by IEEE&nbsp;Std&nbsp;1003.1-2001 to appear when the header is included shall be made visible.</p></li><li><p>Symbols that are explicitly permitted, but not required, by IEEE&nbsp;Std&nbsp;1003.1-2001 to appear in that header (includingthose in reserved name spaces) may be made visible.</p></li><li><p>Additional symbols not required or explicitly permitted by IEEE&nbsp;Std&nbsp;1003.1-2001 to be in that header shall not be madevisible, except when enabled by another feature test macro.</p></li></ol><p>Identifiers in IEEE&nbsp;Std&nbsp;1003.1-2001 may only be undefined using the <b>#undef</b> directive as described in <a href="xsh_chap02_01.html#tag_02_01"><i>Use and Implementation of Functions</i></a> or <a href="#tag_02_02_02">The Name Space</a> . These<b>#undef</b> directives shall follow all <b>#include</b> directives of any header in IEEE&nbsp;Std&nbsp;1003.1-2001. <basefontsize="2"></p><dl><dt><b>Note:</b></dt><dd>The POSIX.1-1990 standard specified a macro called _POSIX_SOURCE. This has been superseded by _POSIX_C_SOURCE.</dd></dl><basefont size="3"> <h5><a name="tag_02_02_01_02"></a>The _XOPEN_SOURCE Feature Test Macro</h5><p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">An XSI-conforming application should ensure that the feature test macro _XOPEN_SOURCE is defined with the value 600 beforeinclusion of any header. This is needed to enable the functionality described in <a href="#tag_02_02_01_01">The _POSIX_C_SOURCEFeature Test Macro</a> and in addition to enable the XSI extension.</p><p>Since this volume of IEEE&nbsp;Std&nbsp;1003.1-2001 is aligned with the ISO&nbsp;C standard, and since all functionality enabledby _POSIX_C_SOURCE set equal to 200112L is enabled by _XOPEN_SOURCE set equal to 600, there should be no need to define_POSIX_C_SOURCE if _XOPEN_SOURCE is so defined. Therefore, if _XOPEN_SOURCE is set equal to 600 and _POSIX_C_SOURCE is set equal to200112L, the behavior is the same as if only _XOPEN_SOURCE is defined and set equal to 600. However, should _POSIX_C_SOURCE be setto a value greater than 200112L, the behavior is unspecified. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p><h4><a name="tag_02_02_02"></a>The Name Space</h4><p>All identifiers in this volume of IEEE&nbsp;Std&nbsp;1003.1-2001, except <i>environ</i>, are defined in at least one of theheaders, as shown in the Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/xbd_chap13.html#tag_13">Chapter 13, Headers</a>. When <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <imgsrc="../images/opt-start.gif" alt="[Option Start]" border="0"> &nbsp;_XOPEN_SOURCE or <img src="../images/opt-end.gif" alt="[Option End]" border="0"> _POSIX_C_SOURCE is defined, each header defines or declares some identifiers, potentially conflictingwith identifiers used by the application. The set of identifiers visible to the application consists of precisely those identifiersfrom the header pages of the included headers, as well as additional identifiers reserved for the implementation. In addition, someheaders may make visible identifiers from other headers as indicated on the relevant header pages.</p><p>Implementations may also add members to a structure or union without controlling the visibility of those members with a featuretest macro, as long as a user-defined macro with the same name cannot interfere with the correct interpretation of the program. Theidentifiers reserved for use by the implementation are described below:</p><ol><li><p>Each identifier with external linkage described in the header section is reserved for use as an identifier with external linkageif the header is included.</p></li><li><p>Each macro described in the header section is reserved for any use if the header is included.</p></li><li><p>Each identifier with file scope described in the header section is reserved for use as an identifier with file scope in the samename space if the header is included.</p></li></ol><p>The prefixes posix_, POSIX_, and _POSIX_ are reserved for use by IEEE&nbsp;Std&nbsp;1003.1-2001 and other POSIX standards.Implementations may add symbols to the headers shown in the following table, provided the identifiers for those symbols begin withthe corresponding reserved prefixes in the following table, and do not use the reserved prefixes posix_, POSIX_, or _POSIX_.</p><hr><center><table border="1" cellpadding="3" align="center"><tr valign="top"><th align="center"><p class="tent"><b>Header</b></p></th><th align="center"><p class="tent"><b>Prefix</b></p></th><th align="center"><p class="tent"><b>Suffix</b></p></th><th align="center"><p class="tent"><b>Complete<br>Name</b></p></th></tr><tr valign="top"><td align="left"><p class="tent"><sup>[<a href="javascript:open_code('AIO')">AIO</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]"border="0"> <b>&lt;aio.h&gt;</b></p></td><td align="left"><p class="tent">aio_, lio_, AIO_, LIO_</p></td><td align="left"><p class="tent">&nbsp;</p></td><td align="left"><p class="tent">&nbsp; <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p></td></tr><tr valign="top"><td align="left"><p class="tent"><b>&lt;arpa/inet.h&gt;</b></p></td><td align="left"><p class="tent">in_, inet_</p></td><td align="left"><p class="tent">&nbsp;</p></td><td align="left"><p class="tent">&nbsp;</p></td></tr><tr valign="top"><td align="left"><p class="tent"><b>&lt;ctype.h&gt;</b></p></td><td align="left"><p class="tent">to[a-z], is[a-z]</p></td><td align="left"><p class="tent">&nbsp;</p></td><td align="left"><p class="tent">&nbsp;</p></td></tr><tr valign="top"><td align="left"><p class="tent"><b>&lt;dirent.h&gt;</b></p></td><td align="left"><p class="tent">d_</p></td><td align="left"><p class="tent">&nbsp;</p></td><td align="left"><p class="tent">&nbsp;</p></td></tr><tr valign="top"><td align="left"><p class="tent"><b>&lt;errno.h&gt;</b></p></td><td align="left"><p class="tent">E[0-9], E[A-Z]</p></td><td align="left"><p class="tent">&nbsp;</p></td><td align="left"><p class="tent">&nbsp;</p></td></tr><tr valign="top"><td align="left"><p class="tent"><b>&lt;fcntl.h&gt;</b></p></td><td align="left"><p class="tent">l_</p></td><td align="left"><p class="tent">&nbsp;</p></td><td align="left"><p class="tent">&nbsp;</p></td></tr><tr valign="top"><td align="left"><p class="tent"><b>&lt;glob.h&gt;</b></p></td><td align="left"><p class="tent">gl_</p></td><td align="left"><p class="tent">&nbsp;</p></td><td align="left"><p class="tent">&nbsp;</p></td></tr><tr valign="top"><td align="left"><p class="tent"><b>&lt;grp.h&gt;</b></p></td><td align="left"><p class="tent">gr_</p></td><td align="left"><p class="tent">&nbsp;</p></td><td align="left"><p class="tent">&nbsp;</p></td></tr><tr valign="top"><td align="left"><p class="tent"><b>&lt;inttypes.h&gt;</b></p></td><td align="left"><p class="tent">&nbsp;</p></td><td align="left"><p class="tent">&nbsp;</p></td><td align="left"><p class="tent">int[0-9a-z_]*_t,</p></td></tr><tr valign="top"><td align="left"><p class="tent"><b>&nbsp;</b></p></td><td align="left"><p class="tent">&nbsp;</p></td><td align="left"><p class="tent">&nbsp;</p></td><td align="left"><p class="tent">uint[0-9a-z_]*_t</p></td></tr><tr valign="top"><td align="left"><p class="tent"><b>&lt;limits.h&gt;</b></p></td><td align="left"><p class="tent">&nbsp;</p></td><td align="left"><p class="tent">_MAX, _MIN</p></td><td align="left"><p class="tent">&nbsp;</p></td></tr><tr valign="top"><td align="left"><p class="tent"><b>&lt;locale.h&gt;</b></p></td><td align="left"><p class="tent">LC_[A-Z]</p></td><td align="left"><p class="tent">&nbsp;</p></td><td align="left"><p class="tent">&nbsp;</p></td></tr><tr valign="top"><td align="left"><p class="tent"><sup>[<a href="javascript:open_code('MSG')">MSG</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]"border="0"> <b>&lt;mqueue.h&gt;</b></p></td><td align="left"><p class="tent">mq_, MQ_</p></td><td align="left"><p class="tent">&nbsp;</p></td><td align="left"><p class="tent">&nbsp; <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p></td></tr><tr valign="top"><td align="left"><p class="tent"><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]"border="0"> <b>&lt;ndbm.h&gt;</b></p></td><td align="left"><p class="tent">dbm_</p></td><td align="left"><p class="tent">&nbsp;</p></td><td align="left"><p class="tent">&nbsp; <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p></td></tr><tr valign="top"><td align="left"><p class="tent"><b>&lt;netdb.h&gt;</b></p></td><td align="left"><p class="tent">h_, n_, p_, s_</p></td><td align="left"><p class="tent">&nbsp;</p></td><td align="left"><p class="tent">&nbsp;</p></td></tr><tr valign="top"><td align="left"><p class="tent"><b>&lt;net/if.h&gt;</b></p></td><td align="left"><p class="tent">if_</p></td><td align="left"><p class="tent">&nbsp;</p></td><td align="left"><p class="tent">&nbsp;</p></td></tr><tr valign="top"><td align="left"><p class="tent"><b>&lt;netinet/in.h&gt;</b></p></td><td align="left"><p class="tent">in_, ip_, s_, sin_</p></td><td align="left"><p class="tent">&nbsp;</p></td><td align="left"><p class="tent">&nbsp;</p></td></tr><tr valign="top"><td align="left"><p class="tent"><sup>[<a href="javascript:open_code('IP6')">IP6</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]"border="0"> <b>&nbsp;</b></p></td><td align="left"><p class="tent">in6_, s6_, sin6_</p></td><td align="left"><p class="tent">&nbsp;</p></td><td align="left"><p class="tent">&nbsp; <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p></td></tr><tr valign="top"><td align="left"><p class="tent"><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]"border="0"> <b>&lt;poll.h&gt;</b></p></td><td align="left"><p class="tent">pd_, ph_, ps_</p></td><td align="left"><p class="tent">&nbsp;</p></td><td align="left"><p class="tent">&nbsp; <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p></td></tr><tr valign="top"><td align="left"><p class="tent"><b>&lt;pthread.h&gt;</b></p></td><td align="left"><p class="tent">pthread_, PTHREAD_</p></td><td align="left"><p class="tent">&nbsp;</p></td><td align="left"><p class="tent">&nbsp;</p></td></tr><tr valign="top"><td align="left"><p class="tent"><b>&lt;pwd.h&gt;</b></p></td><td align="left"><p class="tent">pw_</p></td><td align="left"><p class="tent">&nbsp;</p></td><td align="left"><p class="tent">&nbsp;</p></td></tr><tr valign="top"><td align="left"><p class="tent"><b>&lt;regex.h&gt;</b></p></td><td align="left"><p class="tent">re_, rm_</p></td><td align="left"><p class="tent">&nbsp;</p></td><td align="left"><p class="tent">&nbsp;</p></td></tr><tr valign="top"><td align="left"><p class="tent"><sup>[<a href="javascript:open_code('PS')">PS</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]"border="0"> <b>&lt;sched.h&gt;</b></p></td><td align="left"><p class="tent">sched_, SCHED_</p></td><td align="left"><p class="tent">&nbsp;</p></td><td align="left"><p class="tent">&nbsp; <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p></td></tr><tr valign="top"><td align="left"><p class="tent"><sup>[<a href="javascript:open_code('SEM')">SEM</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]"border="0"> <b>&lt;semaphore.h&gt;</b></p></td><td align="left"><p class="tent">sem_, SEM_</p></td><td align="left"><p class="tent">&nbsp;</p></td><td align="left"><p class="tent">&nbsp; <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p></td></tr><tr valign="top"><td align="left"><p class="tent"><b>&lt;signal.h&gt;</b></p></td><td align="left"><p class="tent">sa_, uc_, SIG[A-Z], SIG_[A-Z]</p></td><td align="left"><p class="tent">&nbsp;</p>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -