?? link.html
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>link</title></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_007_353"> </a>NAME</h4><blockquote>link - link to a file</blockquote><h4><a name = "tag_000_007_354"> </a>SYNOPSIS</h4><blockquote><pre><code>#include <<a href="unistd.h.html">unistd.h</a>>int link(const char *<i>path1</i>, const char *<i>path2</i>);</code></pre></blockquote><h4><a name = "tag_000_007_355"> </a>DESCRIPTION</h4><blockquote>The<i>link()</i>function creates a new link (directory entry) for the existing file,<i>path1</i>.<p>The<i>path1</i>argument points to a pathname naming an existing file.The<i>path2</i>argument points to a pathname naming the new directory entry to be created.The<i>link()</i>function will atomically create a new link for the existing fileand the link count of the file is incremented by one.<p>If<i>path1</i>namesa directory,<i>link()</i>will fail unless the process has appropriate privileges and theimplementation supports using<i>link()</i>on directories.<p>Upon successful completion,<i>link()</i>will mark for update the<i>st_ctime</i>field of the file.Also, the<i>st_ctime</i>and<i>st_mtime</i>fields of the directory that contains the new entryare marked for update.<p>If<i>link()</i>fails, no link is created and the link count of the file will remainunchanged.<p>The implementation may require that the calling process haspermission to access the existing file.</blockquote><h4><a name = "tag_000_007_356"> </a>RETURN VALUE</h4><blockquote>Upon successful completion, 0 is returned.Otherwise, -1 is returned and<i>errno</i>is set to indicate the error.</blockquote><h4><a name = "tag_000_007_357"> </a>ERRORS</h4><blockquote>The<i>link()</i>function will fail if:<dl compact><dt>[EACCES]<dd>A component of either path prefix denies search permission,or the requested link requires writing in a directory with a modethat denies write permission, or the calling process does nothave permission to access the existing file and this is requiredby the implementation.<dt>[EEXIST]<dd>The link named by<i>path2</i>exists.<dt>[ELOOP]<dd>Too many symbolic links were encountered in resolving <i>path1</i> or<i>path2</i>.<dt>[EMLINK]<dd>The number of links to the file named by<i>path1</i>would exceed {LINK_MAX}.<dt>[ENAMETOOLONG]<dd>The length of<i>path1</i>or<i>path2</i>exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX}.<dt>[ENOENT]<dd>A component of either path prefix does not exist;the file named by<i>path1</i>does not exist; or<i>path1</i>or<i>path2</i>points to an empty string.<dt>[ENOSPC]<dd>The directory to contain the link cannot be extended.<dt>[ENOTDIR]<dd>A component of eitherpath prefixis not a directory.<dt>[EPERM]<dd>The file named by<i>path1</i>is a directory and either the calling processdoes not have appropriate privileges or the implementation prohibits using<i>link()</i>on directories.<dt>[EROFS]<dd>The requested link requires writing in a directory on a read-only file system.<dt>[EXDEV]<dd>The link named by<i>path2</i>and the file named by<i>path1</i>are on different file systems and the implementation does not supportlinks between file systems,or <i>path1</i> refers to a named STREAM.</dl><p>The<i>link()</i>function may fail if:<dl compact><dt>[ENAMETOOLONG]<dd>Pathname resolution of a symbolic link produced an intermediate result whoselength exceeds {PATH_MAX}.</dl></blockquote><h4><a name = "tag_000_007_358"> </a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_359"> </a>APPLICATION USAGE</h4><blockquote>Some implementations do allow links between file systems.</blockquote><h4><a name = "tag_000_007_360"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_361"> </a>SEE ALSO</h4><blockquote><i><a href="symlink.html">symlink()</a></i>,<i><a href="unlink.html">unlink()</a></i>,<i><a href="unistd.h.html"><unistd.h></a></i>.</blockquote><h4>DERIVATION</h4><blockquote>Derived from Issue 1 of the SVID.</blockquote><hr size=2 noshade><center><font size=2>UNIX ® is a registered Trademark of The Open Group.<br>Copyright © 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -