man(1) Manual page archive


     LINK(2)                                                   LINK(2)

     NAME
          link, symlink, readlink - link to a file

     SYNOPSIS
          int link(name1, name2)
          char *name1, *name2;

          int symlink(name1, name2)
          char *name1, *name2;

          int readlink(name, buf, size)
          char *name, *buf;

     DESCRIPTION
          Link and symlink create a link to file name1 with new name
          name2. Either name may be an arbitrary path name.

          After link, name2 is entirely equivalent to name1; it is a
          directory entry referring to the same file as name1. Only
          the super-user can make the link if name1 is a directory.

          After symlink, name2 is a new symbolic link; when it is
          encountered in any path name, name1 is substituted for
          name2, and path name parsing continues.  If name1 begins
          with the `/' character, it is interpreted with respect to
          the root directory; if not, it is interpreted with respect
          to the directory in which name2 resides.

          Symbolic links are slightly slower than normal links but may
          span file systems; normal links are confined to a single
          file system.

          Readlink copies the pathname inside symbolic link name into
          memory at buf. No more than size bytes are copied; the
          actual number of bytes read is returned.  The contents of
          buf will not be null-terminated.  An error is returned if
          name is not a symbolic link.

     SEE ALSO
          cp(1), unlink(2), stat(2)

     DIAGNOSTICS
          all: EIO, ELOOP, ENOENT, ENOTDIR
          link: EEXIST, EROFS, EXDEV
          symlink: EEXIST, EROFS
          readlink: ENXIO