execv.html 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <html>
  2. <head>
  3. <title>execv</title>
  4. <body bgcolor=#ffffff>
  5. <h2 align=center>execv</h2>
  6. <h4 align=center>OS/161 Reference Manual</h4>
  7. <h3>Name</h3>
  8. execv - execute a program
  9. <h3>Library</h3>
  10. Standard C Library (libc, -lc)
  11. <h3>Synopsis</h3>
  12. #include &lt;unistd.h&gt;<br>
  13. <br>
  14. int<br>
  15. execv(const char *<em>program</em>, char **<em>args</em>);
  16. <h3>Description</h3>
  17. execv replaces the currently executing program with a newly loaded
  18. program image. This occurs within one process; the process id is
  19. unchanged.
  20. <p>
  21. The pathname of the program to run is passed as <em>program</em>. The
  22. <em>args</em> argument is an array of 0-terminated strings. The array
  23. itself should be terminated by a NULL pointer.
  24. <p>
  25. The argument strings should be copied into the new process as the
  26. new process's argv[] array. In the new process, argv[argc] must be
  27. NULL.
  28. <p>
  29. By convention, argv[0] in new processes contains the name that was
  30. used to invoke the program. This is not necessarily the same as
  31. <em>program</em>, and furthermore is only a convention and should not
  32. be enforced by the kernel.
  33. <p>
  34. The process file table and current working directory are not modified
  35. by execve.
  36. <h3>Return Values</h3>
  37. On success, execv does not return; instead, the new program begins
  38. executing. On failure, execv returns -1, and sets
  39. <A HREF=errno.html>errno</A> to a suitable error code for the error
  40. condition encountered.
  41. <h3>Errors</h3>
  42. The following error codes should be returned under the conditions
  43. given. Other error codes may be returned for other errors not
  44. mentioned here.
  45. <blockquote><table width=90%>
  46. <tr><td width=10%>&nbsp;</td><td>&nbsp;</td></tr>
  47. <tr><td>ENODEV</td> <td>The device prefix of <em>program</em> did
  48. not exist.</td></tr>
  49. <tr><td>ENOTDIR</td> <td>A non-final component of <em>program</em>
  50. was not a directory.</td></tr>
  51. <tr><td>ENOENT</td> <td><em>program</em> did not exist.</td></tr>
  52. <tr><td>EISDIR</td> <td><em>program</em> is a directory.</td></tr>
  53. <tr><td>ENOEXEC</td> <td><em>program</em> is not in a recognizable
  54. executable file format, was for the
  55. wrong platform, or contained invalid
  56. fields.</td></tr>
  57. <tr><td>ENOMEM</td> <td>Insufficient virtual memory is available.</td></tr>
  58. <tr><td>E2BIG</td> <td>The total size of the argument strings is
  59. too large.</td></tr>
  60. <tr><td>EIO</td> <td>A hard I/O error occurred.</td></tr>
  61. <tr><td>EFAULT</td> <td>One of the args is an invalid pointer.</td></tr>
  62. </table></blockquote>
  63. </body>
  64. </html>