<html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title><style type="text/css">
<!--
.style1 {font-size: 18px;font-weight: bold;font-family: Georgia, "Times New Roman", Times, serif;}
.style2 {font-size: 14px}
a{color:#0000cc;text-decoration:none}
a:visited{color:#0000cc;text-decoration:none}
-->
</style></head>
<body style="margin:0px 0px 0px 0px;">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#cccccc"><span class="style1" style="margin-left:5px">sys_link <span class="style2">[fs/namei.c] </span></span></td>
</tr>
<tr>
<td><p style="margin-left:22px;margin-top:0px"><br />
Creates a new link (also known as a hard link) to an existing file. <br />
This system call is identical to <a href="303.html">sys_linkat</a> with <em>ecx</em> and <em>esi</em> set to AT_FDCWD.</p>
<p style="margin-left:10px"><strong>Arguments</strong></p>
<table width="100%" border="0" style="margin-left:20px; margin-right:20px">
<tr>
<td width="6%" valign="top"><em>eax</em></td>
<td width="94%">9</td>
</tr>
<tr>
<td valign="top"><em>ebx</em></td>
<td>Pointer to a null-terminated string specifying the pathname of an existing file. </td>
</tr>
<tr>
<td valign="top"><em>ecx</em></td>
<td>Pointer to a null-terminated string specifying the pathname of the new link. If it is already exists it will not be overwritten. </td>
</tr>
</table>
<p style="margin-left:10px" ><strong>Return values</strong></p>
<p style="margin-left:22px;margin-right:10px" >If the system call succeeds the return value is 0.<br />
If the system call fails the return value is one of the following <em>errno</em> values:</p>
<table width="100%" border="0" style="border:dashed;border-bottom-width:1px;border-left-width:1px;border-right-width:1px;border-top-width:1px;border-color:#333333;margin-left:22px;margin-right:22px">
<tr>
<td><table width="100%" border="0">
<tr>
<td width="10%" valign="top"><code>-EXDEV </code></td>
<td width="90%"><code>Existing file and new link pathnames are not on the same filesystem. </code></td>
</tr>
<tr>
<td valign="top"><code>-EPERM </code></td>
<td><code>The filesystem containing existing file and new link does not support the creation of hard links. </code></td>
</tr>
<tr>
<td valign="top"><code>-EFAULT </code></td>
<td><code><em>ebx</em> or <em>ecx</em> points outside your accessible address space. </code></td>
</tr>
<tr>
<td valign="top"><code>-EACCES </code></td>
<td><code>Write access to the directory containing new link is not allowed for the process's effective UID, or one of the directories in Existing file path or new link path did not allow search (execute) permission. </code></td>
</tr>
<tr>
<td valign="top"><code>-ENAMETOOLONG</code></td>
<td><code>Existing file or new link pathname was too long. </code></td>
</tr>
<tr>
<td valign="top"><code>-ENOENT</code></td>
<td><code>A directory component in existing file or new link pathname does not exist or is a dangling symbolic link. </code></td>
</tr>
<tr>
<td valign="top"><code>-ENOTDIR </code></td>
<td><code>A component used as a directory in existing file or new link pathname is not, in fact, a directory. </code></td>
</tr>
<tr>
<td valign="top"><code>-ENOMEM </code></td>
<td><code>Insufficient kernel memory was available.</code></td>
</tr>
<tr>
<td valign="top"><code>-EROFS </code></td>
<td><code>The file is on a read-only filesystem. </code></td>
</tr>
<tr>
<td valign="top"><code>-EEXIST </code></td>
<td><code>Path pointed by<em> ecx </em> already exists. </code></td>
</tr>
<tr>
<td valign="top"><code>-EMLINK </code></td>
<td><code>The file referred to by <em>ebx</em> already has the maximum number of links to it. </code></td>
</tr>
<tr>
<td valign="top"><code>-ELOOP </code></td>
<td><code>Too many symbolic links were encountered in resolving existing file or new link pathname.</code></td>
</tr>
<tr>
<td valign="top"><code>-ENOSPC </code></td>
<td><code>The device containing the file has no room for the new directory entry. </code></td>
</tr>
<tr>
<td valign="top"><code>-EPERM </code></td>
<td><code>Path pointed by <em>ebx</em> is a directory. </code></td>
</tr>
<tr>
<td valign="top"><code>-EIO </code></td>
<td><code>An I/O error occurred. </code></td>
</tr>
</table></td>
</tr>
</table>
<p style="margin-left:10px"><strong>Remarks</strong></p>
<p style="margin-left:22px">Hard links, as created by sys_link, cannot span filesystems. Use <a href="083.html">sys_symlink</a> if this is required.<br />
On NFS file systems, the return code may be wrong in case the NFS server performs the link creation and dies before it can say so. Use <a href="106.html">sys_stat</a> to find out if the link got created. </p>
<p style="margin-left:10px"><strong>Compatibility</strong></p>
<p style="margin-left:22px">n/a</p></td>
</tr>
</table></body></html>