xref: /csrg-svn/lib/libc/sys/symlink.2 (revision 61186)
1*61186Sbostic.\" Copyright (c) 1983, 1991, 1993
2*61186Sbostic.\"	The Regents of the University of California.  All rights reserved.
320275Smckusick.\"
443568Strent.\" %sccs.include.redist.man%
520275Smckusick.\"
6*61186Sbostic.\"     @(#)symlink.2	8.1 (Berkeley) 06/04/93
738053Sbostic.\"
847208Scael.Dd
947208Scael.Dt SYMLINK 2
1047208Scael.Os BSD 4.2
1147208Scael.Sh NAME
1247208Scael.Nm symlink
1347208Scael.Nd make symbolic link to a file
1447208Scael.Sh SYNOPSIS
1547208Scael.Fd #include <unistd.h>
1647208Scael.Ft int
1747208Scael.Fn symlink "const char *name1" "const char *name2"
1847208Scael.Sh DESCRIPTION
1920275SmckusickA symbolic link
2047208Scael.Fa name2
2120275Smckusickis created to
2247208Scael.Fa name1
2347208Scael.Pf ( Fa name2
2447208Scaelis the name of the
2547208Scaelfile created,
2647208Scael.Fa name1
2747208Scaelis the string
2820275Smckusickused in creating the symbolic link).
2920275SmckusickEither name may be an arbitrary path name; the files need not
3020275Smckusickbe on the same file system.
3147208Scael.Sh RETURN VALUES
3220275SmckusickUpon successful completion, a zero value is returned.
3347208ScaelIf an error occurs, the error code is stored in
3447208Scael.Va errno
3547208Scaeland a -1 value is returned.
3647208Scael.Sh ERRORS
3747208ScaelThe symbolic link succeeds unless:
3847208Scael.Bl -tag -width ENAMETOO
3947208Scael.It Bq Er ENOTDIR
4047208ScaelA component of the
4147208Scael.Fa name2
4247208Scaelprefix is not a directory.
4347208Scael.It Bq Er EINVAL
4447208ScaelEither
4547208Scael.Fa name1
4647208Scaelor
4747208Scael.Fa name2
4820275Smckusickcontains a character with the high-order bit set.
4947208Scael.It Bq Er ENAMETOOLONG
5021004SmckusickA component of either pathname exceeded 255 characters,
5121004Smckusickor the entire length of either path name exceeded 1023 characters.
5247208Scael.It Bq Er ENOENT
5321004SmckusickThe named file does not exist.
5447208Scael.It Bq Er EACCES
5547208ScaelA component of the
5647208Scael.Fa name2
5747208Scaelpath prefix denies search permission.
5847208Scael.It Bq Er ELOOP
5921004SmckusickToo many symbolic links were encountered in translating the pathname.
6047208Scael.It Bq Er EEXIST
6147208Scael.Fa Name2
6247208Scaelalready exists.
6347208Scael.It Bq Er EIO
6447208ScaelAn I/O error occurred while making the directory entry for
6547208Scael.Fa name2 ,
6647208Scaelor allocating the inode for
6747208Scael.Fa name2 ,
6847208Scaelor writing out the link contents of
6947208Scael.Fa name2 .
7047208Scael.It Bq Er EROFS
7147208ScaelThe file
7247208Scael.Fa name2
7347208Scaelwould reside on a read-only file system.
7447208Scael.It Bq Er ENOSPC
7524440SmckusickThe directory in which the entry for the new symbolic link is being placed
7624440Smckusickcannot be extended because there is no space left on the file
7724440Smckusicksystem containing the directory.
7847208Scael.It Bq Er ENOSPC
7924440SmckusickThe new symbolic link cannot be created because there
8024440Smckusickthere is no space left on the file
8124440Smckusicksystem that will contain the symbolic link.
8247208Scael.It Bq Er ENOSPC
8324440SmckusickThere are no free inodes on the file system on which the
8424440Smckusicksymbolic link is being created.
8547208Scael.It Bq Er EDQUOT
8624440SmckusickThe directory in which the entry for the new symbolic link
8724440Smckusickis being placed cannot be extended because the
8824440Smckusickuser's quota of disk blocks on the file system
8924440Smckusickcontaining the directory has been exhausted.
9047208Scael.It Bq Er EDQUOT
9124440SmckusickThe new symbolic link cannot be created because the user's
9224440Smckusickquota of disk blocks on the file system that will
9324440Smckusickcontain the symbolic link has been exhausted.
9447208Scael.It Bq Er EDQUOT
9524440SmckusickThe user's quota of inodes on the file system on
9624440Smckusickwhich the symbolic link is being created has been exhausted.
9747208Scael.It Bq Er EIO
9824440SmckusickAn I/O error occurred while making the directory entry or allocating the inode.
9947208Scael.It Bq Er EFAULT
10047208Scael.Fa Name1
10120275Smckusickor
10247208Scael.Fa name2
10320275Smckusickpoints outside the process's allocated address space.
10447208Scael.El
10547208Scael.Sh SEE ALSO
10647208Scael.Xr link 2 ,
10747208Scael.Xr ln 1 ,
10847208Scael.Xr unlink 2
10947208Scael.Sh HISTORY
11047208ScaelThe
11147208Scael.Nm
11247208Scaelfunction call appeared in
11347208Scael.Bx 4.2 .
114