Open System Services System Calls Reference Manual (G06.25+, H06.03+)

rmdir(2) OSS System Calls Reference Manual
NAME
rmdir - Removes a directory
LIBRARY
G-series native Guardian processes: system library
G-series native OSS processes: system library
H-series native Guardian processes: implicit libraries
H-series OSS processes: implicit libraries
SYNOPSIS
#include <unistd.h>
int rmdir(
const char *path);
PARAMETERS
path Species the directory pathname. The pathname cannot be specied as . (dot) or
..(dot-dot). If either value is used, the call fails and errno is set to [EINVAL].
The nal component of the path parameter cannot be a symbolic link. If the nal
component is a symbolic link, the call fails and errno is set to [ENOTDIR].
DESCRIPTION
The rmdir() function removes the directory specied by the path parameter. The directory is
removed only if it is an empty directory.
For the rmdir() function to execute successfully, the calling process must have write access to
the parent directory of the directory specied by the path parameter.
If no process has the directory open, the space occupied by the directory is freed and the direc-
tory is no longer accessible. If one or more processes have the specied directory open, the .
(dot) and ..(dot-dot) entries in the specied directory, if present, are removed before the rmdir()
function returns, and no new entries can be created in the directory. However, the directory is
not removed until all references to the directory have been closed.
The rmdir() function can be used to remove a root directory (/ cannot be removed) or the current
working directory of a process. However, such an action has the following consequence:
If the root directory of a process is removed, subsequent attempts by that process to
resolve absolute pathnames will fail with errno set to [ENOENT].
If the current working directory of a process is removed, subsequent attempts by that pro-
cess to resolve relative pathnames will fail with errno set to [ENOENT].
If the directory specied by the path parameter is any of the following, the operation fails and
errno is set to [EBUSY]:
/E or /G (the Guardian le system)
A disk volume or process within /G (/G/vol or /G/process)
A mount point for a leset
lost+found in the root directory of a leset
Upon successful completion, the rmdir() function marks the st_ctime and st_mtime elds of
the parent directory for update.
Because directories can have only one link, a successful call to the rmdir() function always sets
the link count to 0 (zero).
632 Hewlett-Packard Company 527186-003