OSDN Git Service

LDP: Update original to LDP v3.68
[linuxjm/LDP_man-pages.git] / original / man2 / rmdir.2
1 .\" This manpage is Copyright (C) 1992 Drew Eckhardt;
2 .\"             and Copyright (C) 1993 Michael Haardt, Ian Jackson.
3 .\"
4 .\" %%%LICENSE_START(VERBATIM)
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.
13 .\"
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.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" %%%LICENSE_END
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>
28 .\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
29 .\"
30 .TH RMDIR 2 2008-05-08 "Linux" "Linux Programmer's Manual"
31 .SH NAME
32 rmdir \- delete a directory
33 .SH SYNOPSIS
34 .B #include <unistd.h>
35 .sp
36 .BI "int rmdir(const char *" pathname );
37 .SH DESCRIPTION
38 .BR rmdir ()
39 deletes a directory, which must be empty.
40 .SH RETURN VALUE
41 On success, zero is returned.
42 On error, \-1 is returned, and
43 .I errno
44 is set appropriately.
45 .SH ERRORS
46 .TP
47 .B EACCES
48 Write access to the directory containing
49 .I pathname
50 was not allowed, or one of the directories in the path prefix of
51 .I pathname
52 did not allow search permission.
53 (See also
54 .BR path_resolution (7).
55 .TP
56 .B EBUSY
57 .I pathname
58 is currently in use by the system or some process that prevents its
59 removal.
60 On Linux this means
61 .I pathname
62 is currently used as a mount point
63 or is the root directory of the calling process.
64 .TP
65 .B EFAULT
66 .IR pathname " points outside your accessible address space."
67 .TP
68 .B EINVAL
69 .I pathname
70 has
71 .I .
72 as last component.
73 .TP
74 .B ELOOP
75 Too 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
82 A directory component in
83 .I pathname
84 does not exist or is a dangling symbolic link.
85 .TP
86 .B ENOMEM
87 Insufficient kernel memory was available.
88 .TP
89 .B ENOTDIR
90 .IR pathname ,
91 or a component used as a directory in
92 .IR pathname ,
93 is not, in fact, a directory.
94 .TP
95 .B ENOTEMPTY
96 .I pathname
97 contains entries other than
98 .IR . " and " .. " ;"
99 or,
100 .I pathname
101 has
102 .I ..
103 as its final component.
104 POSIX.1-2001 also allows
105 .B EEXIST
106 for this condition.
107 .TP
108 .B EPERM
109 The directory containing
110 .I pathname
111 has the sticky bit
112 .RB ( S_ISVTX )
113 set and the process's effective user ID is neither the user ID
114 of the file to be deleted nor that of the directory containing it,
115 and the process is not privileged (Linux: does not have the
116 .B CAP_FOWNER
117 capability).
118 .TP
119 .B EPERM
120 The filesystem containing
121 .I pathname
122 does not support the removal of directories.
123 .TP
124 .B EROFS
125 .I pathname
126 refers to a directory on a read-only filesystem.
127 .SH CONFORMING TO
128 SVr4, 4.3BSD, POSIX.1-2001.
129 .SH BUGS
130 Infelicities in the protocol underlying NFS can cause the unexpected
131 disappearance of directories which are still being used.
132 .SH SEE ALSO
133 .BR rm (1),
134 .BR rmdir (1),
135 .BR chdir (2),
136 .BR chmod (2),
137 .BR mkdir (2),
138 .BR rename (2),
139 .BR unlink (2),
140 .BR unlinkat (2)
141 .SH COLOPHON
142 This page is part of release 3.68 of the Linux
143 .I man-pages
144 project.
145 A description of the project,
146 information about reporting bugs,
147 and the latest version of this page,
148 can be found at
149 \%http://www.kernel.org/doc/man\-pages/.