]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/rmdir.2
Automated addition of parentheses by add_parens_for_own_funcs.sh
[thirdparty/man-pages.git] / man2 / rmdir.2
CommitLineData
fea681da
MK
1.\" Hey Emacs! This file is -*- nroff -*- source.
2.\"
3.\" This manpage is Copyright (C) 1992 Drew Eckhardt;
4.\" 1993 Michael Haardt, Ian Jackson.
5.\"
6.\" Permission is granted to make and distribute verbatim copies of this
7.\" manual provided the copyright notice and this permission notice are
8.\" preserved on all copies.
9.\"
10.\" Permission is granted to copy and distribute modified versions of this
11.\" manual under the conditions for verbatim copying, provided that the
12.\" entire resulting derived work is distributed under the terms of a
13.\" permission notice identical to this one.
14.\"
15.\" Since the Linux kernel and libraries are constantly changing, this
16.\" manual page may be incorrect or out-of-date. The author(s) assume no
17.\" responsibility for errors or omissions, or for damages resulting from
18.\" the use of the information contained herein. The author(s) may not
19.\" have taken the same level of care in the production of this manual,
20.\" which is licensed free of charge, as they might when working
21.\" professionally.
22.\"
23.\" Formatted or processed versions of this manual, if unaccompanied by
24.\" the source, must acknowledge the copyright and authors of this work.
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>
305a0578 28.\" Modified 2004-06-23 by Michael Kerrisk <mtk-manpages@gmx.net>
fea681da
MK
29.\"
30.TH RMDIR 2 2004-06-23 "Linux 2.6.7" "Linux Programmer's Manual"
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
MK
39deletes a directory, which must be empty.
40.SH "RETURN VALUE"
41On success, zero is returned. On error, \-1 is returned, and
42.I errno
43is set appropriately.
44.SH ERRORS
45.TP
46.B EACCES
47Write access to the directory containing
48.I pathname
49was not allowed, or one of the directories in the path prefix of
50.IR pathname
51did not allow search permission.
52(See also
53.BR path_resolution (2).
54.TP
55.B EBUSY
56.I pathname
57is the current working directory or root directory of some process.
58.TP
59.B EFAULT
60.IR pathname " points outside your accessible address space."
61.TP
62.B EINVAL
63.I pathname
64has
65.B .
66as last component.
67.TP
68.B ELOOP
69Too many symbolic links were encountered in resolving
70.IR pathname .
71.TP
72.B ENAMETOOLONG
73.IR pathname " was too long."
74.TP
75.B ENOENT
76A directory component in
77.I pathname
78does not exist or is a dangling symbolic link.
79.TP
80.B ENOMEM
81Insufficient kernel memory was available.
82.TP
83.B ENOTDIR
84.IR pathname ,
85or a component used as a directory in
86.IR pathname ,
87is not, in fact, a directory.
88.TP
89.B ENOTEMPTY
90.I pathname
91contains entries other than
92.BR . " and " .. " ."
93.TP
94.B EPERM
95The directory containing
96.I pathname
97has the sticky bit
98.RB ( S_ISVTX )
99set and the process's effective user ID is neither the user ID of the file to
100be deleted nor that of the directory containing it, and the process is not
101privileged (Linux: does not have the
102.B CAP_FOWNER
103capability).
104.TP
105.B EPERM
106The filesystem containing
107.IR pathname
108does not support the removal of directories.
109.TP
110.B EROFS
111.I pathname
112refers to a file on a read-only filesystem.
113.SH "CONFORMING TO"
b14d4aa5 114SVr4, SVID, POSIX, 4.3BSD
fea681da
MK
115.SH BUGS
116Infelicities in the protocol underlying NFS can cause the unexpected
117disappearance of directories which are still being used.
118.SH "SEE ALSO"
119.BR rm (1),
120.BR rmdir (1),
121.BR chdir (2),
122.BR chmod (2),
123.BR mkdir (2),
124.BR rename (2),
125.BR unlink (2)