Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ unlink(2) — Interactive 2.2

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

close(2)

link(2)

open(2)

rm(1)



          unlink(2)            INTERACTIVE UNIX System            unlink(2)



          NAME
               unlink - remove directory entry

          SYNOPSIS
               int unlink (path)
               char *path;

          DESCRIPTION
               The unlink command removes the directory entry named by the
               path name pointed to by path.

               The named file is unlinked unless one or more of the follow-
               ing 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 effec-
                              tive user ID of the process is not superuser.

               [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]       The path variable points outside the
                              process's allocated address space.

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

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

               [EMULTIHOP]    Components of path require hopping to multi-
                              ple remote machines.

               [ENAMETOOLONG] (POSIX Only)  The length of the path argument
                              exceeds {PATH_MAX}, or a path name component


          Rev. 1.2                                                   Page 1





          unlink(2)            INTERACTIVE UNIX System            unlink(2)



                              is longer than {NAME_MAX} while
                              {_POSIX_NO_TRUNC} is in effect.

               A file will not be unlinked when all of the following is
               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 does not have the appropriate privileges.

               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(2), link(2), open(2).
               rm(1) in the INTERACTIVE UNIX System User's/System
               Administrator's Reference Manual.

          DIAGNOSTICS
               Upon successful completion, a value of 0 is returned.  Oth-
               erwise, a value of -1 is returned, and errno is set to indi-
               cate the error.




























          Rev. 1.2                                                   Page 2



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