Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ln(1)

link(2)

unlink(2)

rename(2)

symlink(2)



  link(2)                             CLIX                             link(2)



  NAME

    link - Creates an additional directory entry for an existing file

  LIBRARY

    Standard C Library (libc.a)

  SYNOPSIS

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

  PARAMETERS

    path1   Points to the pathname of an existing file.

    path2   Points to the pathname for the new directory entry to be created.

  DESCRIPTION

    The link() function creates an additional link (directory entry) for an
    existing file.  Both the old and the new link share equal access rights to
    the underlying object.

  EXAMPLES

    To create a link to an existing file:

    if (link(existing_filename, new_filename) {
             perror("Could not create link");


  RETURN VALUES

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

  ERRORS

    The link() function fails if one or more of the following are true:

    [ENOENT]
           A component of either path prefix does not exist, or the file named
           by the path1 parameter does not exist, or path2 is a NULL pointer.

    [EEXIST]
           The link named by the path2 parameter already exists.




  2/94 - Intergraph Corporation                                              1






  link(2)                             CLIX                             link(2)



    [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 different file systems.

    [EACCES]
           A component of either path prefix denies search permission.  This
           error also occurs if the requested link requires writing in a
           directory with a mode that denies write permission.

    [EMLINK]
           The file already has the maximum number of links.

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

    [ENOSPC]
           The directory in which the entry for the new link is being placed
           cannot be extended because there is no space left on the file
           system that contains the directory.

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

    [EFAULT]
           The path1 or path2 parameter points outside the allocated address
           space of the process.

    [EINTR]
           A signal was caught during the link() function.

    [ENOLINK]
           The path1 or path2 parameter points to a remote machine and the
           link to that machine is no longer active.

    [EMULTIHOP]
           Components of path1 or path2 require hopping to multiple remote
           machines.

    [ENAMETOOLONG]
           The length of the path1 or path2 string exceeds PATH_MAX, or a
           pathname component is longer that NAME_MAX while _POSIX_NO_TRUNC is
           in effect.

  RELATED INFORMATION

    Commands: ln(1)



  2                                              Intergraph Corporation - 2/94






  link(2)                             CLIX                             link(2)



    Functions: unlink(2), rename(2), symlink(2)





















































  2/94 - Intergraph Corporation                                              3




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