📄 symlink.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>symlink</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_009_276"> </a>NAME</h4><blockquote>symlink - make symbolic link to a file</blockquote><h4><a name = "tag_000_009_277"> </a>SYNOPSIS</h4><blockquote><pre><code>#include <<a href="unistd.h.html">unistd.h</a>>int symlink(const char *<i>path1</i>, const char *<i>path2</i>);</code></pre></blockquote><h4><a name = "tag_000_009_278"> </a>DESCRIPTION</h4><blockquote>The<i>symlink()</i>function creates a symbolic link. Its name is the pathname pointed to by<i>path2</i>, which must be a pathname that does not name an existing fileor symbolic link. The contents of the symbolic link are the string pointed toby <i>path1</i>.</blockquote><h4><a name = "tag_000_009_279"> </a>RETURN VALUE</h4><blockquote>Upon successful completion,<i>symlink()</i>returns 0. Otherwise, it returns -1 and sets <i>errno</i> to indicate theerror.</blockquote><h4><a name = "tag_000_009_280"> </a>ERRORS</h4><blockquote>The<i>symlink()</i>function will fail if:<dl compact><dt>[EACCES]<dd>Write permission is denied in the directory where the symbolic link is beingcreated, or search permission is denied for a component of the path prefix of<i>path2</i>.<dt>[EEXIST]<dd>The <i>path2</i> argument names an existing file or symbolic link.<dt>[EIO]<dd>An I/O error occurs while reading from or writing to the file system.<dt>[ELOOP]<dd>Too many symbolic links were encountered in resolving <i>path2</i>.<dt>[ENAMETOOLONG]<dd>The length of the <i>path2</i> argument exceeds {PATH_MAX}, or a pathnamecomponent is longer than {NAME_MAX}.<dt>[ENOENT]<dd>A component of <i>path2</i> does not name an existing fileor <i>path2</i> is an empty string.<dt>[ENOSPC]<dd>The directory in which the entry for the new symbolic link is being placedcannot be extended because no space is left on the file system containing thedirectory, or the new symbolic link cannot be created because no space is lefton the file system which will contain the link, or the file system is out offile-allocation resources.<dt>[ENOTDIR]<dd>A component of the path prefix of <i>path2</i> is not a directory.<dt>[EROFS]<dd>The new symbolic link would reside on a read-only file system.</dl><p>The<i>symlink()</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_009_281"> </a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_009_282"> </a>APPLICATION USAGE</h4><blockquote>Like a hard link,a symbolic link allows a file to have multiple logical names. The presence ofa hard link guarantees the existence of a file, even after the original namehas been removed. A symbolic link provides no such assurance; in fact, thefile named by the <i>path1</i> argument need not exist when the link iscreated. A symbolic link can cross file system boundaries.<p>Normal permission checks are made on each component of thesymbolic link pathname during its resolution.<br></blockquote><h4><a name = "tag_000_009_283"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_009_284"> </a>SEE ALSO</h4><blockquote><i><a href="lchown.html">lchown()</a></i>,<i><a href="link.html">link()</a></i>,<i><a href="lstat.html">lstat()</a></i>,<i><a href="open.html">open()</a></i>,<i><a href="readlink.html">readlink()</a></i>,<i><a href="unistd.h.html"><unistd.h></a></i>.</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 + -