Seth Woolley's Man Viewer

symlink(2) - symlink, symlink - make a new name for a file - man 2 symlink

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

SYMLINK(2)                 Linux Programmer's Manual                SYMLINK(2)

       symlink - make a new name for a file(1,n)

       #include <unistd.h>

       int symlink(const char *oldpath, const char *newpath);

       symlink creates a symbolic link(1,2) named(5,8) newpath which contains the string(3,n)

       Symbolic links are interpreted at run-time as if(3,n) the  contents  of  the
       link(1,2)  had  been substituted into the path being followed to find a file(1,n)
       or directory.

       Symbolic links may contain ..  path components, which (if(3,n) used  at  the
       start of the link(1,2)) refer to the parent directories of that in(1,8) which the
       link(1,2) resides.

       A symbolic link(1,2) (also known as a soft link(1,2)) may point  to  an  existing
       file(1,n)  or  to  a nonexistent one; the latter case is known as a dangling

       The permissions of a symbolic link(1,2) are  irrelevant;  the  ownership  is
       ignored  when following the link(1,2), but is checked when removal or renam-
       ing of the link(1,2) is requested and the link(1,2) is in(1,8) a  directory  with  the
       sticky bit (S_ISVTX) set.

       If newpath exists it will not be overwritten.

       On  success,  zero is returned.  On error(8,n), -1 is returned, and errno is
       set(7,n,1 builtins) appropriately.

       EACCES Write access(2,5) to the directory containing newpath is  denied,  or
              one  of  the  directories  in(1,8) the path prefix of newpath did not
              allow search permission.  (See also path_resolution(2).)

       EEXIST newpath already exists.

       EFAULT oldpath or newpath points outside your accessible address space.

       EIO    An I/O error(8,n) occurred.

       ELOOP  Too many symbolic links were encountered in(1,8) resolving newpath.

              oldpath or newpath was too long.

       ENOENT A directory component in(1,8) newpath does not exist or is a dangling
              symbolic link(1,2), or oldpath is the empty string.

       ENOMEM Insufficient kernel memory was available.

       ENOSPC The device containing the file(1,n) has no room for the new directory

              A  component  used  as a directory in(1,8) newpath is not, in(1,8) fact, a

       EPERM  The filesystem containing newpath does not support the  creation
              of symbolic links.

       EROFS  newpath is on a read-only filesystem.

       No checking of oldpath is done.

       Deleting  the  name  referred  to by a symlink will actually delete the
       file(1,n) (unless it also has other hard links). If this  behaviour  is  not
       desired, use link(1,2).

       SVr4,  SVID,  POSIX,  BSD  4.3.   SVr4 documents additional error(8,n) codes
       SVr4, SVID, BSD 4.3, X/OPEN.  SVr4  documents  additional  error(8,n)  codes
       EDQUOT  and  ENOSYS.  See open(2,3,n)(2) re multiple files with the same name,
       and NFS.

       ln(1), link(1,2)(2),  lstat(2),  open(2,3,n)(2),  path_resolution(2),  readlink(1,2)(2),
       rename(1,2,n)(2), unlink(1,2)(2)

Linux 2.6.7                       2004-06-23                        SYMLINK(2)

References for this manual (incoming links)