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

📄 xbd_chap04.html

📁 IEEE 1003.1-2003, Single Unix Specification v3
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<!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>General Concepts</title></head><body bgcolor="white"><basefont size="3"> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2003 Edition<br>Copyright &copy; 2001-2003 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h2><a name="tag_04"></a>General Concepts</h2><p>For the purposes of IEEE&nbsp;Std&nbsp;1003.1-2001, the general concepts given in <a href="#tag_04">General Concepts</a> apply.<basefont size="2"></p><dl><dt><b>Note:</b></dt><dd>No shading to denote extensions or options occurs in this chapter. Where the terms and definitions given in this chapter areused elsewhere in text related to extensions and options, they are shaded as appropriate.</dd></dl><basefont size="3"> <h3><a name="tag_04_01"></a>Concurrent Execution</h3><p>Functions that suspend the execution of the calling thread shall not cause the execution of other threads to be indefinitelysuspended.</p><h3><a name="tag_04_02"></a>Directory Protection</h3><p>If a directory is writable and the mode bit S_ISVTX is set on the directory, a process may remove or rename files within thatdirectory only if one or more of the following is true:</p><ul><li><p>The effective user ID of the process is the same as that of the owner ID of the file.</p></li><li><p>The effective user ID of the process is the same as that of the owner ID of the directory.</p></li><li><p>The process has appropriate privileges.</p></li></ul><p>If the S_ISVTX bit is set on a non-directory file, the behavior is unspecified.</p><h3><a name="tag_04_03"></a>Extended Security Controls</h3><p>An implementation may provide implementation-defined extended security controls (see <a href="xbd_chap03.html#tag_03_159"><i>Extended Security Controls</i></a> ). These permit an implementation to provide security mechanismsto implement different security policies than those described in IEEE&nbsp;Std&nbsp;1003.1-2001. These mechanisms shall not alteror override the defined semantics of any of the interfaces in IEEE&nbsp;Std&nbsp;1003.1-2001.</p><h3><a name="tag_04_04"></a>File Access Permissions</h3><p>The standard file access control mechanism uses the file permission bits, as described below.</p><p>Implementations may provide <i>additional</i> or <i>alternate</i> file access control mechanisms, or both. An additional accesscontrol mechanism shall only further restrict the access permissions defined by the file permission bits. An alternate file accesscontrol mechanism shall:</p><ul><li><p>Specify file permission bits for the file owner class, file group class, and file other class of that file, corresponding to theaccess permissions.</p></li><li><p>Be enabled only by explicit user action, on a per-file basis by the file owner or a user with the appropriate privilege.</p></li><li><p>Be disabled for a file after the file permission bits are changed for that file with <a href="../functions/chmod.html"><i>chmod</i>()</a>. The disabling of the alternate mechanism need not disable any additional mechanismssupported by an implementation.</p></li></ul><p>Whenever a process requests file access permission for read, write, or execute/search, if no additional mechanism denies access,access shall be determined as follows:</p><ul><li><p>If a process has the appropriate privilege:</p><ul><li><p>If read, write, or directory search permission is requested, access shall be granted.</p></li><li><p>If execute permission is requested, access shall be granted if execute permission is granted to at least one user by the filepermission bits or by an alternate access control mechanism; otherwise, access shall be denied.</p></li></ul></li><li><p>Otherwise:</p><ul><li><p>The file permission bits of a file contain read, write, and execute/search permissions for the file owner class, file groupclass, and file other class.</p></li><li><p>Access shall be granted if an alternate access control mechanism is not enabled and the requested access permission bit is setfor the class (file owner class, file group class, or file other class) to which the process belongs, or if an alternate accesscontrol mechanism is enabled and it allows the requested access; otherwise, access shall be denied.</p></li></ul></li></ul><h3><a name="tag_04_05"></a>File Hierarchy</h3><p>Files in the system are organized in a hierarchical structure in which all of the non-terminal nodes are directories and all ofthe terminal nodes are any other type of file. Since multiple directory entries may refer to the same file, the hierarchy isproperly described as a &quot;directed graph&quot;.</p><h3><a name="tag_04_06"></a>Filenames</h3><p>For a filename to be portable across implementations conforming to IEEE&nbsp;Std&nbsp;1003.1-2001, it shall consist only of theportable filename character set as defined in <a href="xbd_chap03.html#tag_03_276"><i>Portable Filename Character Set</i></a> .</p><p>The hyphen character shall not be used as the first character of a portable filename. Uppercase and lowercase letters shallretain their unique identities between conforming implementations. In the case of a portable pathname, the slash character may alsobe used.</p><h3><a name="tag_04_07"></a>File Times Update</h3><p>Each file has three distinct associated time values: <i>st_atime</i>, <i>st_mtime</i>, and <i>st_ctime</i>. The <i>st_atime</i>field is associated with the times that the file data is accessed; <i>st_mtime</i> is associated with the times that the file datais modified; and <i>st_ctime</i> is associated with the times that the file status is changed. These values are returned in thefile characteristics structure, as described in <a href="sys/stat.h.html"><i>&lt;sys/stat.h&gt;</i></a> .</p><p>Each function or utility in IEEE&nbsp;Std&nbsp;1003.1-2001 that reads or writes data or changes file status indicates which ofthe appropriate time-related fields shall be &quot;marked for update&quot;. If an implementation of such a function or utility marks forupdate a time-related field not specified by IEEE&nbsp;Std&nbsp;1003.1-2001, this shall be documented, except that any changescaused by pathname resolution need not be documented. For the other functions or utilities in IEEE&nbsp;Std&nbsp;1003.1-2001 (thosethat are not explicitly required to read or write file data or change file status, but that in some implementations happen to doso), the effect is unspecified.</p><p>An implementation may update fields that are marked for update immediately, or it may update such fields periodically. At anupdate point in time, any marked fields shall be set to the current time and the update marks shall be cleared. All fields that aremarked for update shall be updated when the file ceases to be open by any process, or when a <a href="../functions/stat.html"><i>stat</i>()</a>, <a href="../functions/fstat.html"><i>fstat</i>()</a>, or <a href="../functions/lstat.html"><i>lstat</i>()</a> is performed on the file. Other times at which updates are done are unspecified. Marksfor update, and updates themselves, are not done for files on read-only file systems; see <a href="xbd_chap03.html#tag_03_304"><i>Read-Only File System</i></a> .</p><h3><a name="tag_04_08"></a>Host and Network Byte Orders</h3><p>When data is transmitted over the network, it is sent as a sequence of octets (8-bit unsigned values). If an entity (such as anaddress or a port number) can be larger than 8 bits, it needs to be stored in several octets. The convention is that all suchvalues are stored with 8 bits in each octet, and with the first (lowest-addressed) octet holding the most-significant bits. This iscalled &quot;network byte order&quot;.</p><p>Network byte order may not be convenient for processing actual values. For this, it is more sensible for values to be stored asordinary integers. This is known as &quot;host byte order&quot;. In host byte order:</p><ul><li><p>The most significant bit might not be stored in the first byte in address order.</p></li><li><p>Bits might not be allocated to bytes in any obvious order at all.</p></li></ul><p>8-bit values stored in <b>uint8_t</b> objects do not require conversion to or from host byte order, as they have the samerepresentation. 16 and 32-bit values can be converted using the <a href="../functions/htonl.html"><i>htonl</i>()</a>, <a href="../functions/htons.html"><i>htons</i>()</a>, <a href="../functions/ntohl.html"><i>ntohl</i>()</a>, and <a href="../functions/ntohs.html"><i>ntohs</i>()</a> functions. When reading data that is to be converted to host byte order, it shouldeither be received directly into a <b>uint16_t</b> or <b>uint32_t</b> object or should be copied from an array of bytes using <ahref="../functions/memcpy.html"><i>memcpy</i>()</a> or similar. Passing the data through other types could cause the byte order tobe changed. Similar considerations apply when sending data.</p><h3><a name="tag_04_09"></a>Measurement of Execution Time</h3><p>The mechanism used to measure execution time shall be implementation-defined. The implementation shall also define to whom theCPU time that is consumed by interrupt handlers and system services on behalf of the operating system will be charged. See <a href="xbd_chap03.html#tag_03_117"><i>CPU Time (Execution Time)</i></a> .</p><h3><a name="tag_04_10"></a>Memory Synchronization</h3><p>Applications shall ensure that access to any memory location by more than one thread of control (threads or processes) isrestricted such that no thread of control can read or modify a memory location while another thread of control may be modifying it.Such access is restricted using functions that synchronize thread execution and also synchronize memory with respect to otherthreads. The following functions synchronize memory with respect to other threads:</p><table cellpadding="3"><tr valign="top"><td align="left"><p class="tent"><br><a href="../functions/fork.html"><i>fork</i>()</a><br><a href="../functions/pthread_barrier_wait.html"><i>pthread_barrier_wait</i>()</a><br><a href="../functions/pthread_cond_broadcast.html"><i>pthread_cond_broadcast</i>()</a><br><a href="../functions/pthread_cond_signal.html"><i>pthread_cond_signal</i>()</a><br><a href="../functions/pthread_cond_timedwait.html"><i>pthread_cond_timedwait</i>()</a><br><a href="../functions/pthread_cond_wait.html"><i>pthread_cond_wait</i>()</a><br><a href="../functions/pthread_create.html"><i>pthread_create</i>()</a><br><a href="../functions/pthread_join.html"><i>pthread_join</i>()</a><br><a href="../functions/pthread_mutex_lock.html"><i>pthread_mutex_lock</i>()</a><br>&nbsp;</p></td><td align="left"><p class="tent"><br><a href="../functions/pthread_mutex_timedlock.html"><i>pthread_mutex_timedlock</i>()</a><br><a href="../functions/pthread_mutex_trylock.html"><i>pthread_mutex_trylock</i>()</a><br><a href="../functions/pthread_mutex_unlock.html"><i>pthread_mutex_unlock</i>()</a><br><a href="../functions/pthread_spin_lock.html"><i>pthread_spin_lock</i>()</a><br><a href="../functions/pthread_spin_trylock.html"><i>pthread_spin_trylock</i>()</a><br><a href="../functions/pthread_spin_unlock.html"><i>pthread_spin_unlock</i>()</a><br><a href="../functions/pthread_rwlock_rdlock.html"><i>pthread_rwlock_rdlock</i>()</a><br><a href="../functions/pthread_rwlock_timedrdlock.html"><i>pthread_rwlock_timedrdlock</i>()</a><br><a href="../functions/pthread_rwlock_timedwrlock.html"><i>pthread_rwlock_timedwrlock</i>()</a><br>&nbsp;</p></td><td align="left"><p class="tent"><br><a href="../functions/pthread_rwlock_tryrdlock.html"><i>pthread_rwlock_tryrdlock</i>()</a><br><a href="../functions/pthread_rwlock_trywrlock.html"><i>pthread_rwlock_trywrlock</i>()</a><br><a href="../functions/pthread_rwlock_unlock.html"><i>pthread_rwlock_unlock</i>()</a><br><a href="../functions/pthread_rwlock_wrlock.html"><i>pthread_rwlock_wrlock</i>()</a><br><a href="../functions/sem_post.html"><i>sem_post</i>()</a><br><a href="../functions/sem_trywait.html"><i>sem_trywait</i>()</a><br><a href="../functions/sem_wait.html"><i>sem_wait</i>()</a><br><a href="../functions/wait.html"><i>wait</i>()</a><br><a href="../functions/waitpid.html"><i>waitpid</i>()</a><br>&nbsp;</p></td></tr></table><p>The <a href="../functions/pthread_once.html"><i>pthread_once</i>()</a> function shall synchronize memory for the first call ineach thread for a given <b>pthread_once_t</b> object.</p>

⌨️ 快捷键说明

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