Creates a symbolic link containing the specified contents.
This function is supported on OpenVMS Integrity servers and
Alpha only.
Format
#include <unistd.h>
int symlink (const char *link_contents, const char *link_name);
1 – Arguments
link_contents
Contents of the symbolic link file, specified as a text string
representing the pathname to which the symbolic link will point.
link_name
The text string representing the name of the symbolic link file.
2 – Description
A symbolic link is a special kind of file that points to another
file. It is a directory entry that associates a filename with a
text string that is interpreted as a POSIX pathname when accessed
by certain services. A symbolic link is implemented on OpenVMS
systems as a file of organization SPECIAL and type SYMBOLIC_LINK.
The symlink function creates a symbolic link (link_name)
containing the specified contents (link_contents). No attempt
is made at link creation time to interpret the symbolic link
contents.
See also readlink, unlink, realpath, lchown, and lstat.
3 – Return Values
0 Successful completion
-1 Indicates an error. errno is set to indicate
the error:
o EACCES - Write permission is denied in the
directory where the symbolic link is being
created, or search permission is denied
for a component of the path prefix of link_
name.
o EEXIST - The link_name argument names an
existing file or symbolic link.
o ENAMETOOLONG - The length of the link_name
argument exceeds PATH_MAX, or a pathname
component is longer than NAME_MAX, or the
length of the link_contents argument is
longer than SYMLINK_MAX.
o ENOSPC - The directory in which the entry
for the new symbolic link is being placed
cannot be extended because no space is
left on the file system containing the
directory, or the new symbolic link cannot
be created because no space is left on the
file system that would contain the link, or
the file system is out of file-allocation
resources.
o Any errno value from creat, fsync, lstat,
or write.