Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ link(2) — DG/UX 4.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought



                                                                  link(2)



        _________________________________________________________________
        link                                                  System Call
        Create a new link to a file.
        _________________________________________________________________


        SYNTAX

        int   link  (old_path, new_path)
        char *      old_path;
        char *      new_path;


        PARAMETERS

        old_path       Address of a pathname to an existing file.


        new_path       Address of a pathname to be added.


        DESCRIPTION

        Link adds the pathname pointed to by <new_path> to the
        filesystem.  The file named by <new_path> is made to identify the
        same file as that named by <old_path>.  Terminal Symbolic links
        are not followed for <new_path>, but are followed for <old_path>.

        The subject file must be of type `ordinary-disk-file', `block-
        special-file', `character-special-file', or `fifo-special-file'.

        It is illegal to link to a file of type directory, socket, or
        symbolic link.

        If link fails, no changes are made.  Otherwise, the following
        changes are made to the subject file:

        *    The subject file's link count attribute (st_nlink) is
             incremented.

        *    The subject file's time of last attribute change (st_ctime)
             is set to the current time.


        ACCESS CONTROL

        The calling process must have permission to resolve <old_path>
        and <new_path>.

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



        DG/UX 4.00                                                 Page 1
               Licensed material--property of copyright holder(s)





                                                                  link(2)



        RETURN VALUE

        0              The new path was successfully created.


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


        EXCEPTIONS

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


        ENOENT         The file named by <old_path> does not exist.


        EEXIST         The link named by <new_path> exists.


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


        EXDEV          The link named by <new_path> and the file named by
                       <old_path> are on different file system devices.


        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 <old_path> or
                       <new_path> does not exist.


        ENOTDIR        A non-terminal component of the <old_path> or
                       <new_path> was not a directory or symbolic link.





        DG/UX 4.00                                                 Page 2
               Licensed material--property of copyright holder(s)





                                                                  link(2)



        ENAMETOOLONG   <old_path> or <new_path> exceeds the length limit
                       for pathnames.


        ENAMETOOLONG   A component of the <old_path> or <new_path>
                       exceeds the length limit for filenames.


        ENOMEM         There are not enough system resources to resolve
                       <old_path> or <new_path> 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          <old_path> or <new_path> contains a character not
                       in the allowed character set.


        EFAULT         <old_path> or <new_path> does not completely
                       reside in the process's address space or the
                       pathname does not terminate in the process's
                       address space.


        SEE ALSO

        The related manual sections:  symlink(2), unlink(2),
        stat(5).






















        DG/UX 4.00                                                 Page 3
               Licensed material--property of copyright holder(s)



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