]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/rmdir.2
intro.1, _exit.2, access.2, alarm.2, alloc_hugepages.2, arch_prctl.2, bind.2, chdir...
[thirdparty/man-pages.git] / man2 / rmdir.2
CommitLineData
fea681da
MK
1.\" This manpage is Copyright (C) 1992 Drew Eckhardt;
2.\" 1993 Michael Haardt, Ian Jackson.
3.\"
93015253 4.\" %%%LICENSE_START(VERBATIM)
fea681da
MK
5.\" Permission is granted to make and distribute verbatim copies of this
6.\" manual provided the copyright notice and this permission notice are
7.\" preserved on all copies.
8.\"
9.\" Permission is granted to copy and distribute modified versions of this
10.\" manual under the conditions for verbatim copying, provided that the
11.\" entire resulting derived work is distributed under the terms of a
12.\" permission notice identical to this one.
c13182ef 13.\"
fea681da
MK
14.\" Since the Linux kernel and libraries are constantly changing, this
15.\" manual page may be incorrect or out-of-date. The author(s) assume no
16.\" responsibility for errors or omissions, or for damages resulting from
17.\" the use of the information contained herein. The author(s) may not
18.\" have taken the same level of care in the production of this manual,
19.\" which is licensed free of charge, as they might when working
20.\" professionally.
c13182ef 21.\"
fea681da
MK
22.\" Formatted or processed versions of this manual, if unaccompanied by
23.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 24.\" %%%LICENSE_END
fea681da
MK
25.\"
26.\" Modified 1993-07-24 by Rik Faith <faith@cs.unc.edu>
27.\" Modified 1997-01-31 by Eric S. Raymond <esr@thyrsus.com>
c11b1abf 28.\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
fea681da 29.\"
6f563870 30.TH RMDIR 2 2008-05-08 "Linux" "Linux Programmer's Manual"
fea681da
MK
31.SH NAME
32rmdir \- delete a directory
33.SH SYNOPSIS
34.B #include <unistd.h>
35.sp
36.BI "int rmdir(const char *" pathname );
37.SH DESCRIPTION
e511ffb6 38.BR rmdir ()
fea681da 39deletes a directory, which must be empty.
47297adb 40.SH RETURN VALUE
c13182ef
MK
41On success, zero is returned.
42On error, \-1 is returned, and
fea681da
MK
43.I errno
44is set appropriately.
45.SH ERRORS
46.TP
47.B EACCES
48Write access to the directory containing
49.I pathname
50was not allowed, or one of the directories in the path prefix of
0daa9e92 51.I pathname
fea681da
MK
52did not allow search permission.
53(See also
ad7cc990 54.BR path_resolution (7).
fea681da
MK
55.TP
56.B EBUSY
57.I pathname
ade10f99
MK
58is currently in use by the system or some process that prevents its
59removal.
60On Linux this means
61.I pathname
62is currently used as a mount point
63or is the root directory of the calling process.
fea681da
MK
64.TP
65.B EFAULT
66.IR pathname " points outside your accessible address space."
67.TP
68.B EINVAL
69.I pathname
70has
836f07c1 71.I .
fea681da
MK
72as last component.
73.TP
74.B ELOOP
75Too many symbolic links were encountered in resolving
76.IR pathname .
77.TP
78.B ENAMETOOLONG
79.IR pathname " was too long."
80.TP
81.B ENOENT
82A directory component in
83.I pathname
84does not exist or is a dangling symbolic link.
85.TP
86.B ENOMEM
87Insufficient kernel memory was available.
88.TP
89.B ENOTDIR
90.IR pathname ,
91or a component used as a directory in
92.IR pathname ,
93is not, in fact, a directory.
94.TP
95.B ENOTEMPTY
96.I pathname
97contains entries other than
ade10f99 98.IR . " and " .. " ;"
c13182ef 99or,
ade10f99
MK
100.I pathname
101has
0daa9e92 102.I ..
ade10f99 103as its final component.
6f563870
MK
104POSIX.1-2001 also allows
105.B EEXIST
106for this condition.
fea681da
MK
107.TP
108.B EPERM
109The directory containing
110.I pathname
111has the sticky bit
112.RB ( S_ISVTX )
c13182ef
MK
113set and the process's effective user ID is neither the user ID
114of the file to be deleted nor that of the directory containing it,
635c9a54 115and the process is not privileged (Linux: does not have the
fea681da
MK
116.B CAP_FOWNER
117capability).
118.TP
119.B EPERM
24d01c53 120The file system containing
0daa9e92 121.I pathname
fea681da
MK
122does not support the removal of directories.
123.TP
124.B EROFS
125.I pathname
7c40de08 126refers to a directory on a read-only file system.
47297adb 127.SH CONFORMING TO
97c1eac8 128SVr4, 4.3BSD, POSIX.1-2001.
fea681da
MK
129.SH BUGS
130Infelicities in the protocol underlying NFS can cause the unexpected
131disappearance of directories which are still being used.
47297adb 132.SH SEE ALSO
fea681da
MK
133.BR rm (1),
134.BR rmdir (1),
135.BR chdir (2),
136.BR chmod (2),
137.BR mkdir (2),
138.BR rename (2),
635c9a54 139.BR unlink (2),
f5958902 140.BR unlinkat (2)