up | Inhaltsverzeichniss | Kommentar

Manual page for RMDIR(2)

rmdir - remove a directory

SYNOPSIS

int rmdir(const char *path);

DESCRIPTION

The rmdir function removes a directory whose name is given by the path argument. The directory must not have any entries other than ``.'' and ``..''.

If the link count of the directory becomes zero and no process has the directory open, then the space occupied is reclaimed by the system. If any process has the directory open when the last link is removed, then the ``.'' and ``..'' are removed and no new entries may be created in the directory. However, the space occupied by the directory itself is not reclaimed until the directory has been closed.

Upon successful completion, the rmdir function marks for update the st_ctime and st_mtime fields of the parent directory from which the named directory is removed.

RETURN VALUE

Upon successful completion, the rmdir function returns a value of zero. Otherwise, a value of -1 is returned and errno is set to indicate the error.

ERRORS

If any of the following conditions occurs, then rmdir returns -1 and sets errno to the corresponding value:
[EACCES]
Search permission is denied for a component of the path prefix.
[EACCES]
Write permission is denied on the directory containing the link to be removed.
[EBUSY]
The directory to be removed is the mount point for a mounted file system.
[EFAULT]
The path argument points outside the process's allocated address space.
[EINVAL]
The pathname contains a character with the high-order bit set.
[EIO]
An I/O error occurred while deleting the directory entry or deallocating the inode.
[ELOOP]
Too many symbolic links were encountered in translating the pathname.
[ENAMETOOLONG]
A component of path exceeds 255 characters, or the entire pathname exceeds 1023 characters. For POSIX applications these values are given by the constants {NAME_MAX} and {PATH_MAX}, respectively.
[ENOTEMPTY]
The named directory contains files other than ``.'' and ``..'' in it.
[ENOENT]
The named directory does not exist.
[ENOENT]
The path argument points to an empty string.
[ENOTDIR]
A component of the path is not a directory.
[EPERM]
The directory containing the directory to be removed is marked sticky, and neither the containing directory nor the directory to be removed are owned by the effective user ID.
[EROFS]
The directory entry to be removed resides on a read-only file system.

SEE ALSO

mkdir(2), unlink(2)


index | Inhaltsverzeichniss | Kommentar

Created by unroff & hp-tools. © somebody (See intro for details). All Rights Reserved. Last modified 11/5/97