Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.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 and J-series native Guardian processes: implicit libraries
H-series and J-series OSS processes: implicit libraries
SYNOPSIS
#include <unistd.h>
int rmdir(
const char *path);
PARAMETERS
path Specifies the directory pathname. The pathname cannot be specified as . (dot) or
..(dot-dot). If either value is used, the call fails and errno is set to [EINVAL].
The final component of the path parameter cannot be a symbolic link. If the final
component is a symbolic link, the call fails and errno is set to [ENOTDIR].
DESCRIPTION
The rmdir() function removes the directory specified 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 specified 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 specified directory open, the .
(dot) and ..(dot-dot) entries in the specified 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 specified by the path parameter is any of the following, the operation fails and
errno is set to [EBUSY]:
• /E or /G (the Guardian file system)
• A disk volume or process within /G (/G/vol or /G/process)
• A mount point for a fileset
• lost+found in the root directory of a fileset
Upon successful completion, the rmdir() function marks the st_ctime and st_mtime fields 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).
6−52 Hewlett-Packard Company 527186-023