Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ unlink(2) — AIX/RT 2.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

close

link

open

rm

     unlink

Purpose

     Removes a directory entry.

Syntax

     int unlink (path)
     char *path;

Description

     The unlink system call removes the directory entry speci-
     fied by  the path parameter.  If  Distributed Services is
     installed  on  your  system,  this path  can  cross  into
     another node.

     When all links  to a file are 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 are
     closed.

Return Value

     Upon successful completion, a value of 0 is returned.  If
     the unlink system  call fails, a value of  -1 is returned
     and errno is set to indicate the error.

Diagnostics

     The unlink  system call fails  and the named file  is not
     unlinked if one or more of the following are true:

     ENOTDIR    A component of the path prefix is not a direc-
                tory.

     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 entry  to be unlinked  is part of  a read-
                only file system.

     EFAULT     The path parameter &pointsout..

     ESTALE     The  process's root  or  current directory  is
                located in a virtual file system that has been
                unmounted.

     If  Distributed Services  is  installed  on your  system,
     unlink can also fail if one  or more of the following are
     true:

     EDIST         The   server   has  blocked   new   inbound
                   requests.

     EDIST         Outbound requests are currently blocked.

     EDIST         The server has a  release level of Distrib-
                   uted Services that  cannot communicate with
                   this node.

     EAGAIN        The  server  is  too  busy  to  accept  the
                   request.

     ESTALE        The file  descriptor for a remote  file has
                   become obsolete.

     EPERM         The translate tables of  the server did not
                   contain any entry  for either the effective
                   user  ID  or  effective  group  ID  of  the
                   calling process.

     ENODEV        The named file is  a remote file located on
                   a  device that  has been  unmounted at  the
                   server.

     ENOMEM        Either  this node  or the  server does  not
                   have enough memory available to service the
                   request.

     ENOCONNECT    An attempt to establish  a new network con-
                   nection with a remote node failed.

     EBADCONNECT   An attempt to use  an existing network con-
                   nection with a remote node failed.

Related Information

     In this book:  "close,"  "link," and "open."

     The  rm   command  in   AIX  Operating   System  Commands
     Reference.

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