rmdir.2 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. .\" Copyright (c) 1983, 1991, 1993
  2. .\" The Regents of the University of California. All rights reserved.
  3. .\"
  4. .\" Redistribution and use in source and binary forms, with or without
  5. .\" modification, are permitted provided that the following conditions
  6. .\" are met:
  7. .\" 1. Redistributions of source code must retain the above copyright
  8. .\" notice, this list of conditions and the following disclaimer.
  9. .\" 2. Redistributions in binary form must reproduce the above copyright
  10. .\" notice, this list of conditions and the following disclaimer in the
  11. .\" documentation and/or other materials provided with the distribution.
  12. .\" 3. Neither the name of the University nor the names of its contributors
  13. .\" may be used to endorse or promote products derived from this software
  14. .\" without specific prior written permission.
  15. .\"
  16. .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  17. .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18. .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  19. .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  20. .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  21. .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  22. .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  23. .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  24. .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  25. .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  26. .\" SUCH DAMAGE.
  27. .\"
  28. .Dd March 30, 2020
  29. .Dt RMDIR 2
  30. .Os
  31. .Sh NAME
  32. .Nm rmdir
  33. .Nd remove a directory file
  34. .Sh LIBRARY
  35. .Lb libc
  36. .Sh SYNOPSIS
  37. .In unistd.h
  38. .Ft int
  39. .Fn rmdir "const char *path"
  40. .Sh DESCRIPTION
  41. The
  42. .Fn rmdir
  43. system call
  44. removes a directory file
  45. whose name is given by
  46. .Fa path .
  47. The directory must not have any entries other
  48. than
  49. .Ql .\&
  50. and
  51. .Ql \&.. .
  52. .Sh RETURN VALUES
  53. .Rv -std rmdir
  54. .Sh ERRORS
  55. The named file is removed unless:
  56. .Bl -tag -width Er
  57. .It Bq Er ENOTDIR
  58. A component of the path is not a directory.
  59. .It Bq Er ENAMETOOLONG
  60. A component of a pathname exceeded 255 characters,
  61. or an entire path name exceeded 1023 characters.
  62. .It Bq Er ENOENT
  63. The named directory does not exist.
  64. .It Bq Er ELOOP
  65. Too many symbolic links were encountered in translating the pathname.
  66. .It Bq Er ENOTEMPTY
  67. The named directory contains files other than
  68. .Ql .\&
  69. and
  70. .Ql ..\&
  71. in it.
  72. .It Bq Er EACCES
  73. Search permission is denied for a component of the path prefix.
  74. .It Bq Er EACCES
  75. Write permission is denied on the directory containing the link
  76. to be removed.
  77. .It Bq Er EPERM
  78. The directory to be removed has its immutable, undeletable or append-only flag
  79. set, see the
  80. .Xr chflags 2
  81. manual page for more information.
  82. .It Bq Er EPERM
  83. The parent directory of the directory to be removed has its immutable or
  84. append-only flag set.
  85. .It Bq Er EPERM
  86. The directory containing the directory to be removed is marked sticky,
  87. and neither the containing directory nor the directory to be removed
  88. are owned by the effective user ID.
  89. .It Bq Er EINVAL
  90. The last component of the path is
  91. .Ql .\&
  92. or
  93. .Ql .. .
  94. .It Bq Er EBUSY
  95. The directory to be removed is the mount point
  96. for a mounted file system.
  97. .It Bq Er EIO
  98. An I/O error occurred while deleting the directory entry
  99. or deallocating the inode.
  100. .It Bq Er EINTEGRITY
  101. Corrupted data was detected while reading from the file system.
  102. .It Bq Er EROFS
  103. The directory entry to be removed resides on a read-only file system.
  104. .It Bq Er EFAULT
  105. The
  106. .Fa path
  107. argument
  108. points outside the process's allocated address space.
  109. .El
  110. .Sh SEE ALSO
  111. .Xr mkdir 2 ,
  112. .Xr unlink 2
  113. .Sh HISTORY
  114. The
  115. .Fn rmdir
  116. system call appeared in
  117. .Bx 4.2 .