Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ rmdir(2) — Reliant UNIX 5.44c4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

mkdir(1)

rm(1)

rmdir(1)

mkdir(2)

remove(3C)

unistd(4)

rmdir(2)                                                           rmdir(2)

NAME
     rmdir - remove a directory

SYNOPSIS
     #include <unistd.h>

     int rmdir(const char *path);

DESCRIPTION
     rmdir() removes the directory named by the pathname pointed to by
     path. The directory must not have any entries other than "." and "..".

     If path is the root directory or the directory of an active process,
     the behavior of rmdir() is unspecified.

     If the directory's link count becomes zero and no process has the
     directory open, the space occupied by the directory is freed. The
     directory is no longer accessible. If one or more processes have the
     directory open when the last link is removed, the "." and ".." entries
     are removed before rmdir() returns and no new entries may be created
     in the directory, but the directory is not removed until all refer-
     ences to the directory have been closed.

     If path is a symbolic link, it is not followed.

     Upon successful completion rmdir() marks for update the stctime and
     stmtime fields of the parent directory.

ERRORS
     The following error code descriptions are function-specific. You will
     find a general description in introprm2(2) or in errno(5).

     The named directory is removed unless one or more of the following
     apply:

     EACCES        Search permission is denied on a component of the path
                   prefix, or write permission is denied on the parent
                   directory of the directory to be removed.

     EACCES        The parent directory has the sticky bit set and is not
                   owned by the user; the directory is not owned by the
                   user and is not writable by the user; the user is not a
                   superuser.

     EBUSY         The directory to be removed is currently in use by the
                   system or by another process.

     EEXIST or ENOTEMPTY
                   The directory contains entries in addition to "." and
                   "..".





Page 1                       Reliant UNIX 5.44                Printed 11/98

rmdir(2)                                                           rmdir(2)

     EFAULT        path points outside the process' allocated address
                   space.

     EINVAL        The directory to be removed is the current directory.

     EINVAL        The directory to be removed is the "." entry of a direc-
                   tory.

     EIO           An I/O error occurred while accessing the file system.

     ELOOP         Too many symbolic links were encountered in translating
                   path.

     EMULTIHOP     Components of path require hopping to multiple remote
                   machines and the file system does not allow it.

     ENAMETOOLONG  The length of the path argument exceeds PATHMAX or the
                   length of a path component exceeds NAMEMAX.

     ENOTDIR       A component of the path prefix is not a directory.

     ENOENT        The named directory does not exist or is the null path-
                   name.

     EROFS         The directory entry to be removed is part of a read-only
                   file system.

     EPERM or EACCES
                   The SISVTX flag is set on the parent directory of the
                   directory to be removed and the caller is not the owner
                   of the directory to be removed, nor is the caller the
                   owner of the parent directory, nor does the caller have
                   the appropriate privileges.

     ENOLINK       path points to a remote machine, and the link to that
                   machine is no longer active.

     The rmdir() function may fail if:

     ENAMETOOLONG  Pathname resolution of a symbolic link produced an
                   intermediate result whose length exceeds PATHMAX.

RESULT
     Upon successful completion, rmdir() returns 0. Otherwise -1 is
     returned, and errno is set to indicate the error.

SEE ALSO
     mkdir(1), rm(1), rmdir(1), mkdir(2), remove(3C), unistd(4).






Page 2                       Reliant UNIX 5.44                Printed 11/98

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026