symlinkat, symlink(2) | make symbolic link to a file |
symlink, symlinkat(2) | make symbolic link to a file |
SYMLINK(2) | MidnightBSD System Calls Manual | SYMLINK(2) |
symlink
, symlinkat
— make symbolic link to a file
Standard C Library (libc, -lc)
#include
<unistd.h>
int
symlink
(const
char *name1, const char
*name2);
int
symlinkat
(const
char *name1, int
fd, const char
*name2);
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
symlinkat
()
system call is equivalent to
symlink
()
except in the case where name2 specifies a relative
path. In this case the symbolic link is created relative to the directory
associated with the file descriptor fd instead of the
current working directory. If symlinkat
() is passed
the special value AT_FDCWD
in the
fd parameter, the current working directory is used
and the behavior is identical to a call to
symlink
().
The symlink
() function returns the
value 0 if successful; otherwise the value -1 is returned and
the global variable errno is set to indicate the
error.
The symbolic link succeeds unless:
ENOTDIR
]ENAMETOOLONG
]ENOENT
]EACCES
]ELOOP
]EEXIST
]EPERM
]EIO
]EROFS
]ENOSPC
]ENOSPC
]ENOSPC
]EDQUOT
]EDQUOT
]EDQUOT
]EINTEGRITY
]EFAULT
]In addition to the errors returned by the
symlink
(), the symlinkat
()
may fail if:
ln(1), chflags(2), link(2), lstat(2), readlink(2), unlink(2), symlink(7)
The symlinkat
() system call follows The
Open Group Extended API Set 2 specification.
The symlink
() system call appeared in
4.2BSD. The symlinkat
()
system call appeared in FreeBSD 8.0.
March 30, 2020 | midnightbsd-3.1 |