Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ link(2) — AIX/RT 2.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

unlink

link

link

Purpose

     Creates  an additional  directory entry  for an  existing
     file.

Syntax

     int link (path1, path2)
     char *path1, *path2;

Description

     The link  system call creates an  additional link (direc-
     tory entry)  for an  existing file.  The  path1 parameter
     points to the  the path name of an existing  file and the
     path2  parameter points  to  the path  name  for the  new
     directory entry  to be created.  If  Distributed Services
     is installed on  your system, these paths  can cross into
     another node.

Return Value

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

Diagnostics

     The link  system call fails  if one  or more of  the fol-
     lowing are true:

     ENOTDIR    A  component of  either path  prefix is  not a
                directory.

     ENOENT     A  component of  either path  prefix does  not
                exist.

     EACCESS    A  component  of  either  path  prefix  denies
                search permission.

     ENOENT     The file named by the path1 parameter does not
                exist.

     EEXIST     The link named by  the path2 parameter already
                exists.

     EPERM      The  file named  by the  path1 parameter  is a
                directory  and the  effective user  ID is  not
                superuser.

     EXDEV      The link named by  the path2 parameter and the
                file named by the  path1 parameter are on dif-
                ferent file systems.

     ENOENT     The  path2 parameter  points  to  a null  path
                name.

     EACCES     The  requested  link  requires  writing  in  a
                directory with  a mode that denies  write per-
                mission.

     EROFS      The  requested  link  requires  writing  in  a
                directory on a read-only file system.

     EFAULT     The path1 or path2 parameter &pointsout..

     EMLINK     The  file already  has the  maximum number  of
                links.

     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, link
     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:  "unlink."

     The link command in  AIX Operating System Commands Refer-
     ence.

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