Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ remove(2) — CLIX 3.1r7.6.28

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

rm(1)

close(2)

link(2)

open(2)

rmdir(2)

unlink(2)



  remove(2)                           CLIX                           remove(2)



  NAME

    remove - Removes a file or directory entry

  LIBRARY

    Standard C Library - (libc.a)

  SYNOPSIS

    int remove(
      char *path );

  PARAMETERS

    path   Specifies the directory entry to be removed.

  DESCRIPTION

    The remove() function removes the file or empty directory entry specified
    by path.

    When all links to a file are removed and no process has the file open, all
    resources associated with the file are reclaimed, and the file is no
    longer accessible.  If one or more processes have the file open when the
    last link is removed, the directory entry disappears, but the removal of
    the file contents is postponed until all references to the file are
    closed.

    For files, remove() is identical to unlink().  For directories, remove()
    is identical to rmdir().

  EXAMPLES

    if (remove("/usr/tmp/testdir") == -1)
            perror("remove failed");


  RETURN VALUES

    Upon successful completion, a value of 0 is returned.  If remove() fails,
    a value of -1 is returned, and the global variable errno is set to
    indicate the error.

  ERRORS

    The remove() function fails and the named file is not removed if one or
    more of the following are true:

    [EEXIST]
           The directory to be removed contains directory entries other than .



  2/94 - Intergraph Corporation                                              1






  remove(2)                           CLIX                           remove(2)



           (the directory itself) and .. (the parent directory).

    [ENOENT]
           The named file does not exist.

    [EACCES]
           Search permission is denied for a component of the path prefix or
           write permission is denied on the directory containing the link to
           be removed.

    [EPERM]
           The named file is a directory, and the calling process is not
           superuser.

    [EBUSY]
           The entry to be removed is the mount point for a mounted file
           system.

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

    [ENAMETOOLONG]
           The length of path exceeds PATH_MAX, or a pathname component is
           longer than NAME_MAX while _POSIX_NO_TRUNC is in effect.

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

    [ETXTBSY]
           The entry to be removed is the last link to a pure procedure
           (shared text) file that is being executed.

    [EFAULT]
           The path parameter points outside the process's allocated address
           space.

    [EINTR]
           A signal was caught during the remove() function.

    [ENOLINK]
           The path parameter points to a remote machine and the link to that
           machine is no longer active.

    [EMULTIHOP]
           Components of path require hopping to multiple remote machines.

  RELATED INFORMATION

    Commands:  rm(1)

    Functions:  close(2), link(2), open(2), rmdir(2), unlink(2)



  2                                              Intergraph Corporation - 2/94




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