Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (SunOS-4.1.3)
Apropos / Subsearch:
optional field

RMDIR(2V)                                                            RMDIR(2V)

       rmdir - remove a directory file

       int rmdir(path)
       char *path;

       rmdir()  removes  a  directory  file  whose name is given by path.  The
       directory must not have any entries other  than  `.'   and  `..'.   The
       directory  must  not  be the root directory or the current directory of
       the calling process.

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

       Upon successful completion, rmdir() marks for update the  st_ctime  and
       st_mtime fields of the parent directory.

       rmdir() returns:

       0      on success.

       -1     on failure and sets errno to indicate the error.

       EACCES              Search  permission is denied for a component of the
                           path prefix of path.

       EACCES              Write permission is denied for the parent directory
                           of the directory to be removed.

       EBUSY               The  directory to be removed is the mount point for
                           a mounted file system, or is being used by  another

       EFAULT              path points outside the process's allocated address

       EINVAL              The directory referred to by path  is  the  current
                           directory, `.'.

       EIO                 An I/O error occurred while reading from or writing
                           to the file system.

       ELOOP               Too many symbolic links were encountered in  trans-
                           lating path.

       ENAMETOOLONG        The length of the path argument exceeds {PATH_MAX}.

                           A  pathname  component  is  longer  than {NAME_MAX}
                           while {_POSIX_NO_TRUNC} is  in  effect  (see  path-

       ENOENT              The directory referred to by path does not exist.

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

       ENOTDIR             The file referred to by path is not a directory.

       ENOTEMPTY           The directory referred to by  path  contains  files
                           other than `.'  and `..'.

       EROFS               The  directory to be removed resides on a read-only
                           file system.

       In addition to the above, the following may also occur:

       ENOENT              path points to a null pathname.

       mkdir(2V), unlink(2V)

                                21 January 1990                      RMDIR(2V)