Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ symlink(S) — OpenDesktop Software Development System 3.0.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

link(S)

ln(C)

lstat(S)

readlink(S)

stat(S)

unlink(S)


 symlink(S)                     6 January 1993                     symlink(S)


 Name

    symlink - creates symbolic link to a file

 Syntax


    cc ... -lc


    int symlink(path, newpath)
    char *path, *newpath;


 Description

    The symlink function creates a symbolic link.  The argument path is the
    name and location of the object to which the symbolic link points.  The
    argument newpath is the name and location of the symbolic link being cre-
    ated.

    The object, path, that the symbolic link, newpath, points to, must be
    specified either as an absolute path, or as a relative path leading from
    the directory containing the symbolic link to the object path. path and
    newpath need not be on the same file systems. The object path need not
    exist for the symbolic link to be created.  Neither path nor newpath can
    be a null string.

    Symbolic links are used only to find objects, therefore they can point to
    any object supported by the filesystem, including, but not limited to,
    regular files, directories, block, character and FIFO special files and
    other symbolic links.

    A call to stat(S) with the symbolic link newpath returns information
    about the file, path, as if stat(S) had been called on path directly.  A
    call to lstat(S) returns information about the symbolic link, newpath.
    Both of these routines are described on the stat(S) manual page.

    Calls to symlink(S) or lstat(S) made on a kernel on which these calls are
    not supported, such as SCO UNIX System V Release 3.2 Version 2.0, produce
    the signal SIGSYS. Programs can be made to operate correctly on kernels
    that do and do not support these routines by first calling lstat(S) and
    then calling stat(S) if SIGSYS is produced by the first call.

    readlink(S) can be used to read the contents of a symbolic link.

    An error is returned if any of the following is true:

    [EACCES]       Search permission denied for a component of the path pre-
                   fix of newpath.

    [EEXIST]       The file specified in newpath already exists.

    [EFAULT]       path or newpath points outside the process's allocated
                   address space.

    [EINVAL]

                   1.  The filesystem on which newpath is created does not
                       support symbolic links

                   2.  The path argument is a null string

    [ELOOP]        Too many symbolic links were encountered in translating
                   the newpath file argument.  The maximum number of symbolic
                   links, that can be found in a pathname, is defined by
                   POSIXSYMLOOP in the <sys/unistd.h> header file.  This
                   value is compiled into the kernel so changing this value
                   does not affect the limit unless the kernel is recompiled.

    [ENAMETOOLONG]

                   1.  The length of a component of newpath exceeds the
                       allowable length of a pathname component on the file-
                       system on which it is to be created, for example, 255
                       characters on EAFS and ES51K filesystems.

                   2.  The length of either path or newpath exceeds 1024
                       characters.

    [ENOENT]       A component of the path prefix of the newpath file argu-
                   ment does not exist.

    [ENOSPC]

                   1.  The directory in which the entry for the new symbolic
                       link is being placed cannot be extended because no
                       space is left on the filesystem containing the direc-
                       tory.

                   2.  The new symbolic link cannot be created because no
                       space is left on the filesystem containing the link.

                   3.  No free inodes are available on the filesystem con-
                       taining the link.

    [ENOTDIR]      A component of the path prefix of the newpath file argu-
                   ment is not a directory.

    [EROFS]        The file specified in newpath would reside on a read-only
                   filesystem.


 Return value

    Upon successful completion, zero (0) is returned.  If an error occurs, an
    error is returned in errno and -1 is returned to the calling routine.

 See also

    link(S), ln(C), lstat(S), readlink(S), stat(S), unlink(S)

 Standards conformance

    symlink is not part of any currently supported standard; it is an exten-
    sion of AT&T System V provided by the Santa Cruz Operation.


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