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

📄 execl.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
📖 第 1 页 / 共 2 页
字号:
with the new process image.<p>If the Message Passing option is supported, all open message queue descriptors in the calling process are closed, as described in<i><a href="mq_close.html">mq_close()</a></i>.<p>If the Asynchronous Input and Output option is supported,any outstanding asynchronous I/O operations may be canceled.Those asynchronous I/O operations that are not canceled will completeas if the<i>exec</i>function had not yet occurred,but any associated signal notifications are suppressed.It is unspecified whether the<i>exec</i>function itself blocks awaiting such I/O completion.In no event, however, will the new process image created by the<i>exec</i>function be affected by the presence of outstanding asynchronous I/Ooperationsat the time the<i>exec</i>function is called.Whether any I/O is cancelled, and which I/O may be cancelled upon<i>exec</i>,is implementation-dependent.<p>The new process also inherits at least the followingattributes from the calling process image:<p>nice value (see<i><a href="nice.html">nice()</a></i>)<br><i>semadj</i> values (see<i><a href="semop.html">semop()</a></i>)<br>process ID<br>parent process ID<br>process group ID<br>session membership<br>real user ID<br>real group ID<br>supplementary group IDs<br>time left until an alarm clock signal (see<i><a href="alarm.html">alarm()</a></i>)<br>current working directory<br>root directory<br>file mode creation mask (see<i><a href="umask.html">umask()</a></i>)<br>file size limit (see<i><a href="ulimit.html">ulimit()</a></i>)<br>process signal mask (see<i><a href="sigprocmask.html">sigprocmask()</a></i>)<br>pending signal (see<i><a href="sigpending.html">sigpending()</a></i>)<br><i>tms_utime</i>,<i>tms_stime</i>,<i>tms_cutime</i>,and<i>tms_cstime</i>(see<i><a href="times.html">times()</a></i>)<br>resource limits<br>controlling terminal<br>interval timers<p>All other process attributes defined in this document will be the samein the new and old process images.The inheritance of process attributes not defined by this specificationis implementation-dependent.<p>A call to any<i>exec</i>function from a process with more than one thread resultsin all threads being terminatedand the new executable image being loaded and executed.No destructor functions will be called.<p>Upon successful completion, the<i>exec</i>functions 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<i>process image file</i>,whether the<i>st_atime</i>field is marked for update is unspecified. Should the<i>exec</i>function succeed, the process image file is considered to have been openedwith<i><a href="open.html">open()</a></i>.The corresponding<i><a href="close.html">close()</a></i>is considered to occur at a time after this open, but beforeprocess termination or successful completion of a subsequent call toone of the<i>exec</i>functions.The argv[] and envp[]arrays of pointers and the strings to which thosearrays point will not be modified by a call to one of the<i>exec</i>functions, except as a consequence of replacing the process image.<p>The saved resource limits in the new process image are set to be a copyof the process's corresponding hard and soft limits.</blockquote><h4><a name = "tag_000_004_059">&nbsp;</a>RETURN VALUE</h4><blockquote>If one of the<i>exec</i>functions returns to the calling process image, an error has occurred;the return value is -1, and<i>errno</i>is set to indicate the error.<br></blockquote><h4><a name = "tag_000_004_060">&nbsp;</a>ERRORS</h4><blockquote>The<i>exec</i>functionswill failif:<dl compact><dt>[E2BIG]<dd>The number of bytes used by the new process image'sargument list and environment list is greater than the system-imposedlimit of {ARG_MAX} bytes.<dt>[EACCES]<dd>Search permission is denied for a directory listed in the newprocess image file's path prefix, or the new process image filedenies execution permission, or the new process image fileis not a regular file and the implementation does not supportexecution of files of its type.<dt>[ELOOP]<dd>Too many symbolic links were encountered in resolving <i>path</i>.<dt>[ENAMETOOLONG]<dd>The length of the<i>path</i>or<i>file</i>arguments, or an element of the environment variableprefixed to a file, exceeds {PATH_MAX}, or a pathname componentis longer than {NAME_MAX}.<dt>[ENOENT]<dd>A component of <i>path</i> or <i>file</i> does not name an existing fileor <i>path</i> or <i>file</i> is an empty string.<dt>[ENOTDIR]<dd>A component of the new process image file's path prefix isnot a directory.</dl><p>The<i>exec</i>functions, except for<i><a href="exec.html">execlp()</a></i>and<i><a href="exec.html">execvp()</a></i>,will fail if:<dl compact><dt>[ENOEXEC]<dd>The new process image file has the appropriate access permission butis not in the proper format.</dl><p>The<i>exec</i>functionsmay fail if:<dl compact><dt>[ENAMETOOLONG]<dd>Pathname resolution of a symbolic link produced an intermediate result whoselength exceeds {PATH_MAX}.<dt>[ENOMEM]<dd>The new process image requires more memory than is allowed bythe hardware or system-imposed memory management constraints.<dt>[ETXTBSY]<dd>The new process imagefile is a pure procedure (shared text) file that iscurrently open for writing by some process.</dl></blockquote><h4><a name = "tag_000_004_061">&nbsp;</a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_004_062">&nbsp;</a>APPLICATION USAGE</h4><blockquote>As the state of conversion descriptors and message cataloguedescriptors in the new process image is undefined, portableapplications should not rely on their use and should closethem prior to calling one of the<i>exec</i>functions.<p>Applications that require other than the default POSIX localeshould call<i><a href="setlocale.html">setlocale()</a></i>with the appropriate parameters to establish the locale of thenew process.<p>The<i>environ</i>array should not be accessed directly by the application.</blockquote><h4><a name = "tag_000_004_063">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_004_064">&nbsp;</a>SEE ALSO</h4><blockquote><i><a href="alarm.html">alarm()</a></i>,<i><a href="atexit.html">atexit()</a></i>,<i><a href="chmod.html">chmod()</a></i>,<i><a href="exit.html">exit()</a></i>,<i><a href="fcntl.html">fcntl()</a></i>,<i><a href="fork.html">fork()</a></i>,<i><a href="fstatvfs.html">fstatvfs()</a></i>,<i><a href="getenv.html">getenv()</a></i>,<i><a href="getitimer.html">getitimer()</a></i>,<i><a href="getrlimit.html">getrlimit()</a></i>,<i><a href="mmap.html">mmap()</a></i>,<i><a href="nice.html">nice()</a></i>,<i><a href="putenv.html">putenv()</a></i>,<i><a href="semop.html">semop()</a></i>,<i><a href="setlocale.html">setlocale()</a></i>,<i><a href="shmat.html">shmat()</a></i>,<i><a href="sigaction.html">sigaction()</a></i>,<i><a href="sigaltstack.html">sigaltstack()</a></i>,<i><a href="sigpending.html">sigpending()</a></i>,<i><a href="sigprocmask.html">sigprocmask()</a></i>,<i><a href="system.html">system()</a></i>,<i><a href="times.html">times()</a></i>,<i><a href="ulimit.html">ulimit()</a></i>,<i><a href="umask.html">umask()</a></i>,<i><a href="unistd.h.html">&lt;unistd.h&gt;</a></i>,<b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b>&nbsp;</a>.<br></blockquote><h4>DERIVATION</h4><blockquote>Derived from Issue 1 of the SVID.</blockquote><hr size=2 noshade><center><font size=2>UNIX &reg; is a registered Trademark of The Open Group.<br>Copyright &copy; 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>

⌨️ 快捷键说明

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