branch for updated copyright for network release
[unix-history] / usr / src / lib / libc / sys / readlink.2
CommitLineData
69e3a22f
KM
1.\" Copyright (c) 1983 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
fd690c8b 5.\" @(#)readlink.2 6.4 (Berkeley) %G%
69e3a22f 6.\"
1acc446f 7.TH READLINK 2 ""
69e3a22f
KM
8.UC 5
9.SH NAME
10readlink \- read value of a symbolic link
11.SH SYNOPSIS
12.nf
13.ft B
14cc = readlink(path, buf, bufsiz)
15int cc;
16char *path, *buf;
17int bufsiz;
18.fi
19.ft R
20.SH DESCRIPTION
21.I Readlink
22places the contents of the symbolic link
23.I name
24in the buffer
0ed030a0 25.I buf,
69e3a22f
KM
26which has size
27.IR bufsiz .
28The contents of the link are not null terminated when returned.
29.SH "RETURN VALUE
30The call returns the count of characters placed in the buffer
31if it succeeds, or a \-1 if an error occurs, placing the error
32code in the global variable \fIerrno\fP.
33.SH "ERRORS
34.I Readlink
35will fail and the file mode will be unchanged if:
36.TP 15
69e3a22f
KM
37[ENOTDIR]
38A component of the path prefix is not a directory.
39.TP 15
b5984ffe
KM
40[EINVAL]
41The pathname contains a character with the high-order bit set.
42.TP 15
43[ENAMETOOLONG]
44A component of a pathname exceeded 255 characters,
45or an entire path name exceeded 1023 characters.
46.TP 15
69e3a22f
KM
47[ENOENT]
48The named file does not exist.
49.TP 15
69e3a22f 50[EACCES]
b5984ffe 51Search permission is denied for a component of the path prefix.
69e3a22f 52.TP 15
b5984ffe
KM
53[ELOOP]
54Too many symbolic links were encountered in translating the pathname.
69e3a22f
KM
55.TP 15
56[EINVAL]
57The named file is not a symbolic link.
58.TP 15
fd690c8b
KM
59[EIO]
60An I/O error occurred while reading from the file system.
61.TP 15
69e3a22f
KM
62[EFAULT]
63.I Buf
64extends outside the process's allocated address space.
69e3a22f
KM
65.SH SEE ALSO
66stat(2), lstat(2), symlink(2)