share/mk/: Remove unused variable
[man-pages.git] / man2 / rmdir.2
blobb3ab4904db9fede07357d1747725f3c330f00bb9
1 .\" This manpage is Copyright (C) 1992 Drew Eckhardt;
2 .\"             and Copyright (C) 1993 Michael Haardt, Ian Jackson.
3 .\"
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\"
6 .\" Modified 1993-07-24 by Rik Faith <faith@cs.unc.edu>
7 .\" Modified 1997-01-31 by Eric S. Raymond <esr@thyrsus.com>
8 .\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
9 .\"
10 .TH rmdir 2 (date) "Linux man-pages (unreleased)"
11 .SH NAME
12 rmdir \- delete a directory
13 .SH LIBRARY
14 Standard C library
15 .RI ( libc ", " \-lc )
16 .SH SYNOPSIS
17 .nf
18 .B #include <unistd.h>
20 .BI "int rmdir(const char *" pathname );
21 .fi
22 .SH DESCRIPTION
23 .BR rmdir ()
24 deletes a directory, which must be empty.
25 .SH RETURN VALUE
26 On success, zero is returned.
27 On error, \-1 is returned, and
28 .I errno
29 is set to indicate the error.
30 .SH ERRORS
31 .TP
32 .B EACCES
33 Write access to the directory containing
34 .I pathname
35 was not allowed, or one of the directories in the path prefix of
36 .I pathname
37 did not allow search permission.
38 (See also
39 .BR path_resolution (7).)
40 .TP
41 .B EBUSY
42 .I pathname
43 is currently in use by the system or some process that prevents its
44 removal.
45 On Linux, this means
46 .I pathname
47 is currently used as a mount point
48 or is the root directory of the calling process.
49 .TP
50 .B EFAULT
51 .IR pathname " points outside your accessible address space."
52 .TP
53 .B EINVAL
54 .I pathname
55 has
56 .I .
57 as last component.
58 .TP
59 .B ELOOP
60 Too many symbolic links were encountered in resolving
61 .IR pathname .
62 .TP
63 .B ENAMETOOLONG
64 .IR pathname " was too long."
65 .TP
66 .B ENOENT
67 A directory component in
68 .I pathname
69 does not exist or is a dangling symbolic link.
70 .TP
71 .B ENOMEM
72 Insufficient kernel memory was available.
73 .TP
74 .B ENOTDIR
75 .IR pathname ,
76 or a component used as a directory in
77 .IR pathname ,
78 is not, in fact, a directory.
79 .TP
80 .B ENOTEMPTY
81 .I pathname
82 contains entries other than
83 .IR . " and " .. " ;"
84 or,
85 .I pathname
86 has
87 .I ..
88 as its final component.
89 POSIX.1 also allows
90 .\" POSIX.1-2001, POSIX.1-2008
91 .B EEXIST
92 for this condition.
93 .TP
94 .B EPERM
95 The directory containing
96 .I pathname
97 has the sticky bit
98 .RB ( S_ISVTX )
99 set and the process's effective user ID is neither the user ID
100 of the file to be deleted nor that of the directory containing it,
101 and the process is not privileged (Linux: does not have the
102 .B CAP_FOWNER
103 capability).
105 .B EPERM
106 The filesystem containing
107 .I pathname
108 does not support the removal of directories.
110 .B EROFS
111 .I pathname
112 refers to a directory on a read-only filesystem.
113 .SH STANDARDS
114 POSIX.1-2008.
115 .SH HISTORY
116 POSIX.1-2001, SVr4, 4.3BSD.
117 .SH BUGS
118 Infelicities in the protocol underlying NFS can cause the unexpected
119 disappearance of directories which are still being used.
120 .SH SEE ALSO
121 .BR rm (1),
122 .BR rmdir (1),
123 .BR chdir (2),
124 .BR chmod (2),
125 .BR mkdir (2),
126 .BR rename (2),
127 .BR unlink (2),
128 .BR unlinkat (2)