rmdir(2) DG/UX 4.30 rmdir(2)
NAME
rmdir - Remove a directory file.
SYNOPSIS
int rmdir (path)
char * path;
PARAMETERS
path Address of a pathname.
DESCRIPTION
<Path> points to a pathname naming an existing directory.
Rmdir removes the directory from the filename store. If
<path> refers to a symbolic link, the symbolic link is
removed, not the target of the symbolic link. The directory
named cannot be the calling process's current working
directory or a directory containing a mounted file system.
The directory should have no entries but '.' and '..',
referring to the directory itself and its parent. There
must be exactly two links to the directory -- its own '.'
and the entry for it in its parent. Note that precluding
the removal of the working directory and non-empty
directories ensures that the current root directory cannot
be removed; if the root were empty, it would have to be the
current working directory.
The directory is removed from the filename store by deleting
the link to it in its parent.
The attributes of the parent change as follows: The number
of links (st_nlink) is decremented, reflecting the fact that
the '..' of the removed directory will no longer refer to
the parent. The time of last attribute change (st_ctime) is
set to the current time.
The attributes of the directory change as follows: Its size
(st_size) and number of links (st_nlink) are set to 0. The
time last modified (st_mtime) and time of last attribute
change (st_ctime) are set to the current time.
Some process may have the directory open for reading at the
time it is removed. Upon attempting the next read
operation, that process will encounter the end-of-file
condition, as the directory's size is now zero.
When the last reference to the directory is deleted
(examples of references are when some process has the
directory open or it is the working or root directory for a
process), the directory is removed from the filesystem.
If the call fails, the directory is not removed, and the
attributes of the directory and its parent are unchanged.
Licensed material--property of copyright holder(s) Page 1
rmdir(2) DG/UX 4.30 rmdir(2)
ACCESS CONTROL
The calling process must have write access to the parent of
the directory being removed.
The process must have permission to resolve <path>.
RETURN VALUE
0 The directory was successfully deleted.
-1 An error occurred. Errno is set to indicate
the error.
EXCEPTIONS
Errno may be set to one of the following error codes:
EACCES Write permission is denied on the directory
containing the link to be removed.
ENOTDIR The file to be removed is not a directory.
EBUSY The directory to be removed is currently in
use by the system (as a mount point for a
mounted file system device, or mounted on a
remote system).
EINVAL The directory to be removed is the current
working directory.
EEXIST The named directory contains files other than
"." and ".." in it.
EEXIST There are not exactly 2 links to the
directory.
EROFS The directory entry to be removed resides on
a file system mounted read-only.
ENOENT The file the pathname resolved to does not
exist.
ENOENT A non-terminal component of the pathname does
not exist.
Licensed material--property of copyright holder(s) Page 2
rmdir(2) DG/UX 4.30 rmdir(2)
ENOTDIR A non-terminal component of the pathname was
not a directory or symbolic link.
ENAMETOOLONG The pathname exceeds the length limit for
pathnames.
ENAMETOOLONG A component of the pathname exceeds the
length limit for filenames.
ENOMEM There are not enough system resources to
resolve the pathname or to expand a symbolic
link.
ELOOP The number of symbolic links encountered
during pathname resolution exceeded
MAXSYMLINKS. A symbolic link cycle is
suspected.
EPERM The pathname contains a character not in the
allowed character set.
EFAULT The pathname does not completely reside in
the process's address space or the pathname
does not terminate in the process's address
space.
SEE ALSO
The related manual sections: mkdir(1), rm(1), rmdir(1),
mkdir(2), unlink(2),
stat(5).
Licensed material--property of copyright holder(s) Page 3