Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

mkdir(1)

rm(1)

rmdir(1)

mkdir(2)

unlink(2)

stat(5)



rmdir(2)                       DG/UX R4.11MU05                      rmdir(2)


NAME
       rmdir - remove a directory file

SYNOPSIS
       #include <unistd.h>

       int  rmdir (path)
       const char * path;

   where:
       path      Address of a pathname naming an existing directory

DESCRIPTION
       Rmdir removes the directory from the filename store.  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: the number of
       links to the directory (st_nlink) is set to 0, and the time last
       modified (st_mtime) and time of last attribute change (st_ctime) are
       set to the current time.

       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.

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.

DIAGNOSTICS
       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.

       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
       mkdir(1), rm(1), rmdir(1), mkdir(2), unlink(2), stat(5).


Licensed material--property of copyright holder(s)

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