link.html 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <html>
  2. <head>
  3. <title>link</title>
  4. <body bgcolor=#ffffff>
  5. <h2 align=center>link</h2>
  6. <h4 align=center>OS/161 Reference Manual</h4>
  7. <h3>Name</h3>
  8. link - create hard link to a file
  9. <h3>Library</h3>
  10. Standard C Library (libc, -lc)
  11. <h3>Synopsis</h3>
  12. #include &lt;unistd.h&gt;<br>
  13. <br>
  14. int<br>
  15. link(const char *<em>oldname</em>, const char *<em>newname</em>);
  16. <h3>Description</h3>
  17. link creates a new name, <em>newname</em>, for the file referred to by
  18. <em>oldname</em>. Henceforth, both names are equally valid ways to
  19. refer to the same file. The file is only deleted when all names are
  20. removed. This is a "hard link".
  21. <p>
  22. The creation of the new name is atomic. The two names must be on the
  23. same filesystem. Directories may not be hard-linked.
  24. <p>
  25. <h3>Return Values</h3>
  26. On success, link returns 0. On error, -1 is returned, and
  27. <A HREF=errno.html>errno</A> is set according to the error
  28. encountered.
  29. <h3>Errors</h3>
  30. The following error codes should be returned under the conditions
  31. given. Other error codes may be returned for other errors not
  32. mentioned here.
  33. <blockquote><table width=90%>
  34. <td width=10%>&nbsp;</td><td>&nbsp;</td></tr>
  35. <tr><td>ENODEV</td> <td>The device prefix of one of the names did
  36. not exist.</td></tr>
  37. <tr><td>ENOTDIR</td> <td>A non-final component of one of the names
  38. was not a directory.</td></tr>
  39. <tr><td>ENOENT</td> <td>A non-final component of <em>newname</em>
  40. did not exist.</td></tr>
  41. <tr><td>ENOENT</td> <td><em>oldname</em> does not exist.</td></tr>
  42. <tr><td>EEXIST</td> <td><em>newname</em> already exists.</td></tr>
  43. <tr><td>EISDIR</td> <td><em>oldname</em> is a directory.</td></tr>
  44. <tr><td>EXDEV</td> <td>The two names are on different
  45. filesystems.</td></tr>
  46. <tr><td>EMLINK</td> <td>There are already too many links to
  47. <em>oldname</em>.</td></tr>
  48. <tr><td>ENOSPC</td> <td>The filesystem involved is full.</td></tr>
  49. <tr><td>EIO</td> <td>A hard I/O error occurred.</td></tr>
  50. <tr><td>EFAULT</td> <td>One of the arguments was an invalid pointer.</td></tr>
  51. </table></blockquote>
  52. </body>
  53. </html>