*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->HP-UX 11i man pages -> link (2)              
Title
Content
Arch
Section
 

Contents


 link(2)                                                             link(2)




 NAME    [Toc]    [Back]
      link() - link to a file

 SYNOPSIS    [Toc]    [Back]
      #include <unistd.h>

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

 DESCRIPTION    [Toc]    [Back]
      The link() system call creates a new link (directory entry) for the
      existing file.  path1 points to a path name naming an existing file.
      path2 points to a path name naming the new directory entry to be
      created.

 RETURN VALUE    [Toc]    [Back]
      Upon successful completion, link() returns zero.  Otherwise, it
      returns -1 and sets errno (see errno(2)) to indicate the error.

 ERRORS    [Toc]    [Back]
      The link() system call fails and no link is created if one or more of
      the following is true:

           [EACCES]                 A component of either path prefix denies
                                    search permission.

           [EACCES]                 The requested link requires writing in a
                                    directory that does not permit writing.

           [EDQUOT]                 The user's disk quota block limit has
                                    been reached for this file system.

           [EEXIST]                 The link named by path2 exists.

           [ENOENT]                 The file named by path1 does not exist.

           [ENOENT]                 A component of either path prefix does
                                    not exist.

           [ENOENT]                 path2 points to a null path name.

           [ENOSPC]                 The directory to contain the file cannot
                                    be extended.

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

           [EPERM]                  The file named by path1 is a directory
                                    and the effective user ID is not a user
                                    who has appropriate privileges.  Some
                                    file systems return this error whenever
                                    path1 names a directory, regardless of



 Hewlett-Packard Company            - 1 -   HP-UX 11i Version 2: August 2003






 link(2)                                                             link(2)




                                    the user ID.

           [EXDEV]                  The link named by path2 and the file
                                    named by path1 are on different logical
                                    devices (file systems).

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

           [EFAULT]                 path points outside the allocated
                                    address space of the process.  The
                                    reliable detection of this error is
                                    implementation dependent.

           [ENOENT]                 path1 or path2 is null.

           [EMLINK]                 The maximum number of links to a file
                                    would be exceeded.

           [ENAMETOOLONG]           Either the specified path exceeds
                                    PATH_MAX bytes, or a component of either
                                    specified path exceeds NAME_MAX while
                                    POSIX_NO_TRUNC is in effect.

           [ELOOP]                  Too many symbolic links were encountered
                                    in translating either path name.

 DEPENDENCIES    [Toc]    [Back]
    Series 700
      If path2 names a symbolic link, link() fails without creating the
      link, it returns -1, and sets errno to the following value:

           [EEXIST]                 path2 names a symbolic link.

 SEE ALSO    [Toc]    [Back]
      cp(1), link(1M), symlink(2), unlink(2), symlink(4).

 STANDARDS CONFORMANCE    [Toc]    [Back]
      link(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1


 Hewlett-Packard Company            - 2 -   HP-UX 11i Version 2: August 2003
[ Back ]
      
      
 Similar pages
Name OS Title
ln Tru64 Make a hard link or a symbolic link to a file
link Tru64 Create a hard link to an existing file on the local file system
link Linux link a file
pxflink IRIX Creates a link to a file
ipxlink IRIX Link ipx streams driver to Link Layer
symlink Tru64 Make a symbolic link to a file
link FreeBSD make a hard file link
symlink NetBSD make symbolic link to a file
symlink FreeBSD make symbolic link to a file
symlink HP-UX make symbolic link to a file
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service