Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ unlink(S) — OpenDesktop Software Development System 1.0.0d

Media Vault

Software Library

Restoration Projects

Artifacts Sought



     UNLINK(S)                 UNIX System V                 UNLINK(S)



     Name
          unlink - remove directory entry

     Syntax
          int unlink (path)
          char *path;

     Description
          unlink removes the directory entry named by the path name
          pointed to by path.

          The named file is unlinked unless one or more of the
          following is true:

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

          [ENOENT]       The named file does not exist.

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

          [EACCES]       Write permission is denied on the directory
                         containing the link to be removed.

          [EPERM]        The named file is a directory and the
                         effective user ID of the process is not
                         super-user.

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

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

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

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

          [EINTR]        A signal was caught during the unlink system
                         call.

          [ENOLINK]      path 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.

          A file will not be unlinked when all of the following
          conditions are true:

               the parent directory has the sticky bit set
               the file is not writable by the user
               the user does not own the parent directory
               the user does not own the file
               the user is not root

          When all links to a file have been removed and no process
          has the file open, the space occupied by the file is freed
          and the file ceases to exist.  If one or more processes have
          the file open when the last link is removed, the removal is
          postponed until all references to the file have been closed.

     See Also
          close(S), link(S), open(S), rm(C)

     Diagnostics
          Upon successful completion, a value of 0 is returned.
          Otherwise, a value of -1 is returned and errno is set to
          indicate the error.

     Standards Conformance
          unlink is conformant with:
          AT&T SVID Issue 2, Select Code 307-127;
          The X/Open Portability Guide II of January 1987;
          IEEE POSIX Std 1003.1-1988 with C Standard Language-
          Dependent System Support;
          and NIST FIPS 151-1.
                                                (printed 6/20/89)



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