200 lines
6.6 KiB
HTML
200 lines
6.6 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
|
|
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
|
|
<title>symlink</title>
|
|
</head>
|
|
<body bgcolor="white">
|
|
|
|
<basefont size="3"> <a name="symlink"></a> <a name="tag_03_753"></a><!-- symlink -->
|
|
<!--header start-->
|
|
<center><font size="2">The Open Group Base Specifications Issue 6<br>
|
|
IEEE Std 1003.1-2001<br>
|
|
Copyright © 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
|
|
|
|
<!--header end-->
|
|
<hr size="2" noshade>
|
|
<h4><a name="tag_03_753_01"></a>NAME</h4>
|
|
|
|
<blockquote>symlink - make a symbolic link to a file</blockquote>
|
|
|
|
<h4><a name="tag_03_753_02"></a>SYNOPSIS</h4>
|
|
|
|
<blockquote class="synopsis">
|
|
<p><code><tt>#include <<a href="../basedefs/unistd.h.html">unistd.h</a>><br>
|
|
<br>
|
|
int symlink(const char *</tt><i>path1</i><tt>, const char *</tt><i>path2</i><tt>);<br>
|
|
</tt></code></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_753_03"></a>DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>symlink</i>() function shall create a symbolic link called <i>path2</i> that contains the string pointed to by
|
|
<i>path1</i> ( <i>path2</i> is the name of the symbolic link created, <i>path1</i> is the string contained in the symbolic
|
|
link).</p>
|
|
|
|
<p>The string pointed to by <i>path1</i> shall be treated only as a character string and shall not be validated as a pathname.</p>
|
|
|
|
<p>If the <i>symlink</i>() function fails for any reason other than [EIO], any file named by <i>path2</i> shall be unaffected.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_753_04"></a>RETURN VALUE</h4>
|
|
|
|
<blockquote>
|
|
<p>Upon successful completion, <i>symlink</i>() shall return 0; otherwise, it shall return -1 and set <i>errno</i> to indicate the
|
|
error.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_753_05"></a>ERRORS</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>symlink</i>() function shall fail if:</p>
|
|
|
|
<dl compact>
|
|
<dt>[EACCES]</dt>
|
|
|
|
<dd>Write permission is denied in the directory where the symbolic link is being created, or search permission is denied for a
|
|
component of the path prefix of <i>path2</i>.</dd>
|
|
|
|
<dt>[EEXIST]</dt>
|
|
|
|
<dd>The <i>path2</i> argument names an existing file or symbolic link.</dd>
|
|
|
|
<dt>[EIO]</dt>
|
|
|
|
<dd>An I/O error occurs while reading from or writing to the file system.</dd>
|
|
|
|
<dt>[ELOOP]</dt>
|
|
|
|
<dd>A loop exists in symbolic links encountered during resolution of the <i>path2</i> argument.</dd>
|
|
|
|
<dt>[ENAMETOOLONG]</dt>
|
|
|
|
<dd>
|
|
The length of the <i>path2</i> argument exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX} or the length of the
|
|
<i>path1</i> argument is longer than {SYMLINK_MAX}.</dd>
|
|
|
|
<dt>[ENOENT]</dt>
|
|
|
|
<dd>A component of <i>path2</i> does not name an existing file or <i>path2</i> is an empty string.</dd>
|
|
|
|
<dt>[ENOSPC]</dt>
|
|
|
|
<dd>The directory in which the entry for the new symbolic link is being placed cannot be extended because no space is left on the
|
|
file system containing the directory, or the new symbolic link cannot be created because no space is left on the file system which
|
|
shall contain the link, or the file system is out of file-allocation resources.</dd>
|
|
|
|
<dt>[ENOTDIR]</dt>
|
|
|
|
<dd>A component of the path prefix of <i>path2</i> is not a directory.</dd>
|
|
|
|
<dt>[EROFS]</dt>
|
|
|
|
<dd>The new symbolic link would reside on a read-only file system.</dd>
|
|
</dl>
|
|
|
|
<p>The <i>symlink</i>() function may fail if:</p>
|
|
|
|
<dl compact>
|
|
<dt>[ELOOP]</dt>
|
|
|
|
<dd>More than {SYMLOOP_MAX} symbolic links were encountered during resolution of the <i>path2</i> argument.</dd>
|
|
|
|
<dt>[ENAMETOOLONG]</dt>
|
|
|
|
<dd>
|
|
As a result of encountering a symbolic link in resolution of the <i>path2</i> argument, the length of the substituted pathname
|
|
string exceeded {PATH_MAX} bytes (including the terminating null byte), or the length of the string pointed to by <i>path1</i>
|
|
exceeded {SYMLINK_MAX}.</dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<hr>
|
|
<div class="box"><em>The following sections are informative.</em></div>
|
|
|
|
<h4><a name="tag_03_753_06"></a>EXAMPLES</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_753_07"></a>APPLICATION USAGE</h4>
|
|
|
|
<blockquote>
|
|
<p>Like a hard link, a symbolic link allows a file to have multiple logical names. The presence of a hard link guarantees the
|
|
existence of a file, even after the original name has been removed. A symbolic link provides no such assurance; in fact, the file
|
|
named by the <i>path1</i> argument need not exist when the link is created. A symbolic link can cross file system boundaries.</p>
|
|
|
|
<p>Normal permission checks are made on each component of the symbolic link pathname during its resolution.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_753_08"></a>RATIONALE</h4>
|
|
|
|
<blockquote>
|
|
<p>Since IEEE Std 1003.1-2001 does not require any association of file times with symbolic links, there is no requirement
|
|
that file times be updated by <i>symlink</i>().</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_753_09"></a>FUTURE DIRECTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_753_10"></a>SEE ALSO</h4>
|
|
|
|
<blockquote>
|
|
<p><a href="lchown.html"><i>lchown</i>()</a> , <a href="link.html"><i>link</i>()</a> , <a href="lstat.html"><i>lstat</i>()</a> , <a
|
|
href="open.html"><i>open</i>()</a> , <a href="readlink.html"><i>readlink</i>()</a> , <a href="unlink.html"><i>unlink</i>()</a> ,
|
|
the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/unistd.h.html"><i><unistd.h></i></a></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_753_11"></a>CHANGE HISTORY</h4>
|
|
|
|
<blockquote>
|
|
<p>First released in Issue 4, Version 2.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_753_12"></a>Issue 5</h4>
|
|
|
|
<blockquote>
|
|
<p>Moved from X/OPEN UNIX extension to BASE.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_753_13"></a>Issue 6</h4>
|
|
|
|
<blockquote>
|
|
<p>The following changes were made to align with the IEEE P1003.1a draft standard:</p>
|
|
|
|
<ul>
|
|
<li>
|
|
<p>The DESCRIPTION text is updated.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>The [ELOOP] optional error condition is added.</p>
|
|
</li>
|
|
</ul>
|
|
</blockquote>
|
|
|
|
<div class="box"><em>End of informative text.</em></div>
|
|
|
|
<hr>
|
|
<hr size="2" noshade>
|
|
<center><font size="2"><!--footer start-->
|
|
UNIX ® is a registered Trademark of The Open Group.<br>
|
|
POSIX ® is a registered Trademark of The IEEE.<br>
|
|
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
|
|
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
|
|
]</font></center>
|
|
|
|
<!--footer end-->
|
|
<hr size="2" noshade>
|
|
</body>
|
|
</html>
|
|
|