124 lines
3.0 KiB
HTML
124 lines
3.0 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<TITLE>link(2)</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<H1>link(2)</H1>
|
|
<HR>
|
|
<PRE>
|
|
|
|
</PRE>
|
|
<H2>NAME</H2><PRE>
|
|
link - make a hard link to a file
|
|
|
|
|
|
</PRE>
|
|
<H2>SYNOPSIS</H2><PRE>
|
|
<STRONG>#include</STRONG> <STRONG><unistd.h></STRONG>
|
|
|
|
<STRONG>int</STRONG> <STRONG>link(const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG><EM>name1</EM><STRONG>,</STRONG> <STRONG>const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG><EM>name2</EM><STRONG>)</STRONG>
|
|
|
|
|
|
</PRE>
|
|
<H2>DESCRIPTION</H2><PRE>
|
|
A hard link to <EM>name1</EM> is created; the link has the name <EM>name2</EM>. <EM>Name1</EM> must
|
|
exist.
|
|
|
|
With hard links, both <EM>name1</EM> and <EM>name2</EM> must be in the same file system.
|
|
<EM>Name1</EM> must not be a directory. Both the old and the new <EM>link</EM> share equal
|
|
access and rights to the underlying object.
|
|
|
|
|
|
</PRE>
|
|
<H2>RETURN VALUE</H2><PRE>
|
|
Upon successful completion, a value of 0 is returned. Otherwise, a value
|
|
of -1 is returned and <STRONG>errno</STRONG> is set to indicate the error.
|
|
|
|
|
|
</PRE>
|
|
<H2>ERRORS</H2><PRE>
|
|
<STRONG>Link</STRONG> will fail and no link will be created if one or more of the
|
|
following are true:
|
|
|
|
[ENOTDIR] A component of either path prefix is not a directory.
|
|
|
|
[ENAMETOOLONG] A path name exceeds PATH_MAX characters.
|
|
|
|
[ENOENT] A component of either path prefix does not exist.
|
|
|
|
[EACCES] A component of either path prefix denies search
|
|
permission.
|
|
|
|
[EACCES] The requested link requires writing in a directory with a
|
|
mode that denies write permission.
|
|
|
|
[ELOOP] Too many symbolic links were encountered in translating
|
|
one of the pathnames. (Minix-vmd)
|
|
|
|
[ENOENT] The file named by <EM>name1</EM> does not exist.
|
|
|
|
[EEXIST] The link named by <EM>name2</EM> does exist.
|
|
|
|
[EPERM] The file named by <EM>name1</EM> is a directory and the effective
|
|
user ID is not super-user.
|
|
|
|
[EXDEV] The link named by <EM>name2</EM> and the file named by <EM>name1</EM> are on
|
|
different file systems.
|
|
|
|
|
|
[ENOSPC] The directory in which the entry for the new link is being
|
|
placed cannot be extended because there is no space left
|
|
on the file system containing the directory.
|
|
|
|
[EIO] An I/O error occurred while reading from or writing to the
|
|
file system to make the directory entry.
|
|
|
|
[EROFS] The requested link requires writing in a directory on a
|
|
read-only file system.
|
|
|
|
[EFAULT] One of the pathnames specified is outside the process's
|
|
allocated address space.
|
|
|
|
|
|
</PRE>
|
|
<H2>SEE ALSO</H2><PRE>
|
|
<STRONG><A HREF="../man2/symlink.2.html">symlink(2)</A></STRONG>, <STRONG><A HREF="../man2/unlink.2.html">unlink(2)</A></STRONG>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</PRE>
|
|
</BODY>
|
|
</HTML>
|