2 .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved
3 .\" Copyright 1989 AT&T
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH RMDIR 2 "May 18, 2007"
9 rmdir \- remove a directory
15 \fBint\fR \fBrmdir\fR(\fBconst char *\fR\fIpath\fR);
21 The \fBrmdir()\fR function removes the directory named by the path name pointed
22 to by \fIpath\fR. The directory must not have any entries other than
23 "\fB\&.\fR" and "\fB\&..\fR".
26 If the directory's link count becomes zero and no process has the directory
27 open, the space occupied by the directory is freed and the directory is no
28 longer accessible. If one or more processes have the directory open when the
29 last link is removed, the "\fB\&.\fR" and "\fB\&..\fR" entries, if present, are
30 removed before \fBrmdir()\fR returns and no new entries may be created in the
31 directory, but the directory is not removed until all references to the
32 directory have been closed.
35 Upon successful completion \fBrmdir()\fR marks for update the \fBst_ctime\fR
36 and \fBst_mtime\fR fields of the parent directory.
40 Upon successful completion, \fB0\fR is returned. Otherwise, \fB\(mi1\fR is
41 returned, \fBerrno\fR is set to indicate the error, and the named directory is
46 The \fBrmdir()\fR function will fail if:
53 Search permission is denied for a component of the path prefix and
54 {\fBPRIV_FILE_DAC_SEARCH\fR} is not asserted in the effective set of the
57 Write permission is denied on the directory containing the directory to be
58 removed and {\fBPRIV_FILE_DAC_WRITE\fR} is not asserted.
60 The parent directory has the \fBS_ISVTX\fR variable set, is not owned by the
61 user, and {\fBPRIV_FILE_OWNER\fR} is not asserted.
63 The directory is not owned by the user and is not writable by the user.
72 The directory to be removed is the mount point for a mounted file system.
81 The directory contains entries other than those for "\fB\&.\fR" and
91 The \fIpath\fR argument points to an illegal address.
100 The directory to be removed is the current directory, or the final component of
101 \fIpath\fR is "\fB\&.\fR".
110 The path argument includes non-UTF8 characters and the file system accepts only
111 file names where all characters are part of the UTF-8 character codeset.
120 An I/O error occurred while accessing the file system.
129 Too many symbolic links were encountered in translating \fIpath\fR.
135 \fB\fBENAMETOOLONG\fR\fR
138 The length of the \fIpath\fR argument exceeds \fBPATH_MAX\fR, or the length of
139 a \fIpath\fR component exceeds \fINAME_MAX\fR while \fB_POSIX_NO_TRUNC\fR is in
149 The named directory does not exist or is the null pathname.
158 The \fIpath\fR argument points to a remote machine, and the connection to that
159 machine is no longer active.
168 A component of the path prefix is not a directory.
177 The directory entry to be removed is part of a read-only file system.
183 See \fBattributes\fR(5) for descriptions of the following attributes:
191 ATTRIBUTE TYPE ATTRIBUTE VALUE
193 Interface Stability Standard
195 MT-Level Async-Signal-Safe
201 \fBmkdir\fR(1), \fBrm\fR(1), \fBmkdir\fR(2), \fBattributes\fR(5),
202 \fBprivileges\fR(5), \fBstandards\fR(5)