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

📄 execve.html

📁 posix标准英文,html格式
💻 HTML
📖 第 1 页 / 共 4 页
字号:
state set to PTHREAD_CANCEL_ENABLED.</p><p>The initial thread in the new process image shall have all thread-specific data values set to NULL and all thread-specific datakeys shall be removed by the call to <i>exec</i> without running destructors.</p><p>The initial thread in the new process image shall be joinable, as if created with the <i>detachstate</i> attribute set toPTHREAD_CREATE_JOINABLE. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p><p>The new process shall inherit at least the following attributes from the calling process image:</p><ul><li><p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">Nice value (see <a href="nice.html"><i>nice</i>()</a>) <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p></li><li><p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"><i>semadj</i> values (see <a href="semop.html"><i>semop</i>()</a>) <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p></li><li><p>Process ID</p></li><li><p>Parent process ID</p></li><li><p>Process group ID</p></li><li><p>Session membership</p></li><li><p>Real user ID</p></li><li><p>Real group ID</p></li><li><p>Supplementary group IDs</p></li><li><p>Time left until an alarm clock signal (see <a href="alarm.html"><i>alarm</i>()</a>)</p></li><li><p>Current working directory</p></li><li><p>Root directory</p></li><li><p>File mode creation mask (see <a href="umask.html"><i>umask</i>()</a>)</p></li><li><p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">File size limit (see <a href="ulimit.html"><i>ulimit</i>()</a>) <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p></li><li><p>Process signal mask (see <a href="sigprocmask.html"><i>sigprocmask</i>()</a>)</p></li><li><p>Pending signal (see <a href="sigpending.html"><i>sigpending</i>()</a>)</p></li><li><p><i>tms_utime</i>, <i>tms_stime</i>, <i>tms_cutime</i>, and <i>tms_cstime</i> (see <a href="times.html"><i>times</i>()</a>)</p></li><li><p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">Resource limits <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p></li><li><p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">Controlling terminal <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p></li><li><p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">Interval timers <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p></li></ul><p>The initial thread of the new process shall inherit at least the following attributes from the calling thread:</p><ul><li><p>Signal mask (see <a href="../functions/sigprocmask.html"><i>sigprocmask</i>()</a> and <a href="../functions/pthread_sigmask.html"><i>pthread_sigmask</i>()</a>)</p></li><li><p>Pending signals (see <a href="../functions/sigpending.html"><i>sigpending</i>()</a>)</p></li></ul><p>All other process attributes defined in this volume of IEEE&nbsp;Std&nbsp;1003.1-2001 shall be inherited in the new processimage from the old process image. All other thread attributes defined in this volume of IEEE&nbsp;Std&nbsp;1003.1-2001 shall beinherited in the initial thread in the new process image from the calling thread in the old process image. The inheritance ofprocess or thread attributes not defined by this volume of IEEE&nbsp;Std&nbsp;1003.1-2001 is implementation-defined.</p><p><sup>[<a href="javascript:open_code('THR')">THR</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> Acall to any <i>exec</i> function from a process with more than one thread shall result in all threads being terminated and the newexecutable image being loaded and executed. No destructor functions or cleanup handlers shall be called. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p><p>Upon successful completion, the <i>exec</i> functions shall mark for update the <i>st_atime</i> field of the file. If an<i>exec</i> function failed but was able to locate the process image file, whether the <i>st_atime</i> field is marked for updateis unspecified. Should the <i>exec</i> function succeed, the process image file shall be considered to have been opened with <ahref="../functions/open.html"><i>open</i>()</a>. The corresponding <a href="../functions/close.html"><i>close</i>()</a> shall beconsidered to occur at a time after this open, but before process termination or successful completion of a subsequent call to oneof the <i>exec</i> functions, <a href="../functions/posix_spawn.html"><i>posix_spawn</i>()</a>, or <a href="../functions/posix_spawnp.html"><i>posix_spawnp</i>()</a>. The <i>argv</i>[] and <i>envp</i>[] arrays of pointers and the stringsto which those arrays point shall not be modified by a call to one of the <i>exec</i> functions, except as a consequence ofreplacing the process image.</p><p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">The saved resource limits in the new process image are set to be a copy of the process' corresponding hard and soft limits. <imgsrc="../images/opt-end.gif" alt="[Option End]" border="0"></p></blockquote><h4><a name="tag_03_130_04"></a>RETURN VALUE</h4><blockquote><p>If one of the <i>exec</i> functions returns to the calling process image, an error has occurred; the return value shall be -1,and <i>errno</i> shall be set to indicate the error.</p></blockquote><h4><a name="tag_03_130_05"></a>ERRORS</h4><blockquote><p>The <i>exec</i> functions shall fail if:</p><dl compact><dt>[E2BIG]</dt><dd>The number of bytes used by the new process image's argument list and environment list is greater than the system-imposed limitof {ARG_MAX} bytes.</dd><dt>[EACCES]</dt><dd>Search permission is denied for a directory listed in the new process image file's path prefix, or the new process image filedenies execution permission, or the new process image file is not a regular file and the implementation does not support executionof files of its type.</dd><dt>[EINVAL]</dt><dd>The new process image file has the appropriate permission and has a recognized executable binary format, but the system doesnot support execution of a file with this format.</dd><dt>[ELOOP]</dt><dd>A loop exists in symbolic links encountered during resolution of the <i>path</i> or <i>file</i> argument.</dd><dt>[ENAMETOOLONG]</dt><dd>The length of the <i>path</i> or <i>file</i> arguments exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX}.</dd><dt>[ENOENT]</dt><dd>A component of <i>path</i> or <i>file</i> does not name an existing file or <i>path</i> or <i>file</i> is an empty string.</dd><dt>[ENOTDIR]</dt><dd>A component of the new process image file's path prefix is not a directory.</dd></dl><p>The <i>exec</i> functions, except for <i>execlp</i>() and <i>execvp</i>(), shall fail if:</p><dl compact><dt>[ENOEXEC]</dt><dd>The new process image file has the appropriate access permission but has an unrecognized format.</dd></dl><p>The <i>exec</i> functions 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> or <i>file</i> argument.</dd><dt>[ENAMETOOLONG]</dt><dd>As a result of encountering a symbolic link in resolution of the <i>path</i> argument, the length of the substituted pathnamestring exceeded {PATH_MAX}.</dd><dt>[ENOMEM]</dt><dd>The new process image requires more memory than is allowed by the hardware or system-imposed memory managementconstraints.</dd><dt>[ETXTBSY]</dt><dd>The new process image file is a pure procedure (shared text) file that is currently open for writing by some process.</dd></dl></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_03_130_06"></a>EXAMPLES</h4><blockquote><h5><a name="tag_03_130_06_01"></a>Using execl()</h5><p>The following example executes the <a href="../utilities/ls.html"><i>ls</i></a> command, specifying the pathname of theexecutable ( <b>/bin/ls</b>) and using arguments supplied directly to the command to produce single-column output.</p><pre><tt>#include &lt;unistd.h&gt;<br>int ret;...ret = execl ("/bin/ls", "ls", "-1", (char *)0);</tt></pre><h5><a name="tag_03_130_06_02"></a>Using execle()</h5><p>The following example is similar to <a href="#tag_03_130_06_01">Using execl()</a>. In addition, it specifies the environmentfor the new process image using the <i>env</i> argument.</p><pre><tt>#include &lt;unistd.h&gt;<br>int ret;char *env[] = { "HOME=/usr/home", "LOGNAME=home", (char *)0 };...ret = execle ("/bin/ls", "ls", "-l", (char *)0, env);</tt></pre>

⌨️ 快捷键说明

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