Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ link(2) — DG/UX 5.4.2A

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

symlink(2)

unlink(2)

stat(5)



link(2)                          DG/UX 5.4.2                         link(2)


NAME
       link - create a new link to a file

SYNOPSIS
       int  link (oldpath, newpath)
       char * oldpath;
       char * newpath;

DESCRIPTION
       Use link(2) to assign an additional pathname to an existing file:

       oldpath
               is a pathname to an existing file.

       newpath
               is the additional pathname to be assigned to the file.

       After this call, the names oldpath and newpath identify the same
       file.

       The oldpath must already exist. The file it points to may be an
       ordinary disk file, or a special file of type block, character, or
       fifo. The file may not be a directory, a control point directory, or
       a socket.

       The newpath must not already exist. If it does, the call fails and
       sets the EEXIST error condition.

       The link(2) call will not span logical file systems or control point
       directories. An error results if oldpath and newpath are locations
       in different logical file systems or control point directories.

       If oldpath is a symbolic link, link(2) first follows the link to its
       termination. The call will fail if the termination is invalid for
       oldpath, as explained above.  If newpath is a symbolic link, the
       call fails without following the link.

       If link(2) fails, no changes are made to the file indicated by
       oldpath.  If the call succeeds:

       ⊕      The file's link count attribute (stnlink) is incremented.

       ⊕      The file's time of last change attribute (stctime) is set to
              the current time.

ACCESS CONTROL
       The calling process must have permission to resolve oldpath and
       newpath.

       The calling process must have write permission to the directory
       containing the entry to be added.

RETURN VALUE
       0      The new path was successfully created.



Licensed material--property of copyright holder(s)                         1




link(2)                          DG/UX 5.4.2                         link(2)


       -1     An error occurred.  errno is set to indicate the error.

DIAGNOSTICS
       Errno may be set to one of the following error codes:

       ENOENT         The file named by oldpath does not exist.

       EEXIST         The link named by newpath exists.

       EPERM          Permission to link to the given file type is denied to
                      the calling process.

       EXDEV          The link named by newpath and the file named by
                      oldpath are in different logical file systems, or
                      different control point directories.

       EACCES         The requested link requires writing in a directory
                      with a mode that denies write permission.

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

       EMLINK         Too many links to one file.  There can only be MAXLINK
                      links to one file.  See <sys/param.h>.

       ENOSPC         No more contiguous space for file space or inodes.

       ENOENT         A non-terminal component of the oldpath or newpath
                      does not exist.

       ENOTDIR        A non-terminal component of the oldpath or newpath
                      was not a directory or symbolic link.

       ENAMETOOLONG   oldpath or newpath exceeds the length limit for
                      pathnames.

       ENAMETOOLONG   A component of the oldpath or newpath exceeds the
                      length limit for filenames.

       ENOMEM         There are not enough system resources to resolve
                      oldpath or newpath or to expand a symbolic link.

       ELOOP          The number of symbolic links encountered during
                      pathname resolution exceeded MAXSYMLINKS.  A symbolic
                      link cycle is suspected.

       EPERM          oldpath or newpath contains a character not in the
                      allowed character set.

       EFAULT         oldpath or newpath does not completely reside in the
                      process's address space or the pathname does not
                      terminate in the process's address space.





Licensed material--property of copyright holder(s)                         2




link(2)                          DG/UX 5.4.2                         link(2)


SEE ALSO
       symlink(2), unlink(2), stat(5).























































Licensed material--property of copyright holder(s)                         3


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