Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ln(1V)

link(2V)

readlink(2)

unlink(2V)

SYMLINK(2)  —  SYSTEM CALLS

NAME

symlink − make symbolic link to a file

SYNOPSIS

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

DESCRIPTION

A symbolic link name2 is created to name1 (name2 is the name of the file created, name1 is the string used in creating the symbolic link).  Either name may be an arbitrary path name; the files need not be on the same file system. 

The file that the symbolic link points to is used when an open(2V) operation is performed on the link.  A stat(2V), on a symbolic link returns the linked-to file, while an lstat() (refer to stat(2V)) returns information about the link itself.  This can lead to surprising results when a symbolic link is made to a directory.  To avoid confusion in programs, the readlink(2) call can be used to read the contents of a symbolic link. 

RETURN VALUES

symlink() returns:

0 on success. 

−1 on failure and sets errno to indicate the error. 

ERRORS

The symbolic link is made unless one or more of the following are true:

EACCES Search permission is denied for a component of the path prefix of name2.

EDQUOT The directory in which the entry for the new symbolic link is being placed cannot be extended because the user’s quota of disk blocks on the file system containing the directory has been exhausted. 

The new symbolic link cannot be created because the user’s quota of disk blocks on the file system which will contain the link has been exhausted. 

The user’s quota of inodes on the file system on which the file is being created has been exhausted. 

EEXIST The file referred to by name2 already exists. 

EFAULT name1 or name2 points outside the process’s allocated address space. 

EIO An I/O error occurred while reading from or writing to the file system. 

ELOOP Too many symbolic links were encountered in translating name2.

ENAMETOOLONG The length of the path argument exceeds {PATH_MAX}. 

A pathname component is longer than {NAME_MAX} (see sysconf(2V)) while {_POSIX_NO_TRUNC} is in effect (see pathconf(2V)). 

ENOENT A component of the path prefix of name2 does not exist. 

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

The new symbolic link cannot be created because there is no space left on the file system which will contain the link. 

There are no free inodes on the file system on which the file is being created. 

ENOTDIR A component of the path prefix of name2 is not a directory. 

EROFS The file name2 would reside on a read-only file system. 

SEE ALSO

ln(1V), link(2V), readlink(2), unlink(2V)

Solbourne Computer, Inc.  —  12 Dec 1990

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