rmdir.html 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <html>
  2. <head>
  3. <title>rmdir</title>
  4. <body bgcolor=#ffffff>
  5. <h2 align=center>rmdir</h2>
  6. <h4 align=center>OS/161 Reference Manual</h4>
  7. <h3>Name</h3>
  8. rmdir - remove directory
  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. rmdir(const char *<em>pathname</em>);
  16. <h3>Description</h3>
  17. rmdir removes the directory named by <em>pathname</em>. The directory
  18. (and all the components in its path prefix) must exist. The directory
  19. must be empty, except for "." and "..", and may not be the root
  20. directory of the filesystem.
  21. <p>
  22. It is invalid to attempt to remove the "." or ".." entries in a
  23. directory. What rmdir actually removes is a name in some (other)
  24. directory; removing the "." or ".." <strong>names</strong> would make
  25. a mess. It is not invalid for a process to remove its own current
  26. directory, but it does not work to do so by calling rmdir(".").
  27. <p>
  28. It is impossible in any event to remove a directory named with "..",
  29. because it is impossible to name a directory with ".." unless it is
  30. not empty.
  31. <p>
  32. You must decide what happens if an attempt is made to remove a
  33. directory that is presently in use (e.g., is being read by ls, or is
  34. some process's current directory, etc.)
  35. <p>
  36. The removal must be atomic.
  37. <p>
  38. <h3>Return Values</h3>
  39. On success, rmdir returns 0. On error, -1 is returned, and
  40. <A HREF=errno.html>errno</A> is set according to the error
  41. encountered.
  42. <h3>Errors</h3>
  43. The following error codes should be returned under the conditions
  44. given. Other error codes may be returned for other errors not
  45. mentioned here.
  46. <blockquote><table width=90%>
  47. <td width=10%>&nbsp;</td><td>&nbsp;</td></tr>
  48. <tr><td>ENODEV</td> <td>The device prefix of <em>filename</em> did
  49. not exist.</td></tr>
  50. <tr><td>ENOTDIR</td> <td>A non-final component of <em>pathname</em>
  51. was not a directory.</td></tr>
  52. <tr><td>ENOTDIR</td> <td><em>pathname</em> referred to an object that
  53. was not a directory.</td></tr>
  54. <tr><td>ENOENT</td> <td>The target directory did not exist.</td></tr>
  55. <tr><td>EINVAL</td> <td>An attempt was made to remove "."</td></tr>
  56. <tr><td>ENOTEMPTY</td> <td>The target directory was not empty.</td></tr>
  57. <tr><td>EIO</td> <td>A hard I/O error occurred.</td></tr>
  58. <tr><td>EFAULT</td> <td><em>pathname</em> was an invalid pointer.</td></tr>
  59. </table></blockquote>
  60. Attempts to remove ".." may generate either EINVAL or ENOTEMPTY.
  61. </body>
  62. </html>