Manual page for RMDIR(2V)
rmdir - remove a directory file
SYNOPSIS
int rmdir(path)
char *path;
DESCRIPTION
rmdir()
removes a directory file whose name is given by
path.
The directory must not have any entries other than
`.'
and
`..'.
The directory must not be the root directory or the
current directory of the calling process.
If the directory's link count becomes zero, and no process has the
directory open, the space occupied by the directory is freed and the directory
is no longer accessible.
If one or more processes have the directory open when the last
link is removed, the
`.'
and
`..'.
entries, if present, are removed before
rmdir()
returns and no new entries may be created in the directory, but the
directory is not removed until all references to the directory
have been closed.
Upon successful completion,
rmdir()
marks for update the
st_ctime
and
st_mtime
fields of the parent directory.
RETURN VALUES
rmdir()
returns:
- 0
-
on success.
- -1
-
on failure and sets
errno
to indicate the error.
ERRORS
- EACCES
-
Search permission is denied for a component of the path prefix of
path.
- EACCES
-
Write permission is denied for the parent directory of the
directory to be removed.
- EBUSY
-
The directory to be removed is the mount point for a mounted file system,
or is being used by another process.
- EFAULT
-
path
points outside the process's allocated address space.
- EINVAL
-
The directory referred to by
path
is the current directory,
`.'.
- EIO
-
An I/O error occurred while reading from or writing to the file system.
- ELOOP
-
Too many symbolic links were encountered in translating
path.
- ENAMETOOLONG
-
The length of the path argument exceeds
{PATH_MAX}.
A pathname component is longer than
{NAME_MAX}
while
{_POSIX_NO_TRUNC}
is in effect
(see
pathconf.2v
- ENOENT
-
The directory referred to by
path
does not exist.
- ENOTDIR
-
A component of the path prefix of
path
is not a directory.
- ENOTDIR
-
The file referred to by
path
is not a directory.
- ENOTEMPTY
-
The directory referred to by
path
contains files other than
`.'
and
`..'.
- EROFS
-
The directory to be removed resides on a read-only file system.
SYSTEM V ERRORS
In addition to the above, the following may also occur:
- ENOENT
-
path
points to a null pathname.
SEE ALSO
mkdir.2v
unlink.2v
Created by unroff & hp-tools.
© somebody (See intro for details). All Rights Reserved.
Last modified 11/5/97