Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ link(2) — HP-UX 7.01

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cp(1)

link(1M)

symlink(2)

symlink(4)

unlink(2)

LINK(2)

NAME

link − link to a file

SYNOPSIS

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

DESCRIPTION

Path1 points to a path name naming an existing file.  Path2 points to a path name naming the new directory entry to be created.  Link creates a new link (directory entry) for the existing file. 

ERRORS

Link will fail and no link will be created if one or more of the following are true:

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

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

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

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

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

[EEXIST] The link named by path2 exists. 

[EPERM] The file named by path1 is a directory and the effective user ID is not super-user. 

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

[ENOENT] Path2 points to a null path name. 

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

[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 will be implementation dependent. 

[ENOENT] Path1 or path2 is null. 

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

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

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

RETURN VALUE

Upon successful completion, a value of 0 is returned.  Otherwise, a value of −1 is returned and errno is set to indicate the error. 

SEE ALSO

cp(1), link(1M), symlink(2), symlink(4), unlink(2). 

STANDARDS CONFORMANCE

link: SVID2, XPG2, XPG3, POSIX.1, FIPS 151-1

Hewlett-Packard Company  —  HP-UX Release 7.0: Sept 1989

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