SCCS id got lost along the way
[unix-history] / usr / src / lib / libc / sys / readlink.2
CommitLineData
931b8415 1.\" Copyright (c) 1983, 1991 The Regents of the University of California.
88b3ccf2 2.\" All rights reserved.
69e3a22f 3.\"
91cff1e1 4.\" %sccs.include.redist.man%
88b3ccf2 5.\"
931b8415 6.\" @(#)readlink.2 6.8 (Berkeley) %G%
69e3a22f 7.\"
931b8415
CL
8.Dd
9.Dt READLINK 2
10.Os BSD 4.2
11.Sh NAME
12.Nm readlink
13.Nd read value of a symbolic link
14.Sh SYNOPSIS
15.Fd #include <unistd.h>
16.Ft int
17.Fn readlink "const char *path" "char *buf" "int bufsiz"
18.Sh DESCRIPTION
19.Fn Readlink
69e3a22f 20places the contents of the symbolic link
931b8415 21.Fa path
69e3a22f 22in the buffer
931b8415 23.Fa buf ,
69e3a22f 24which has size
931b8415
CL
25.Fa bufsiz .
26.Nm Readlink
27does not append a
28.Dv NUL
29character to
30.Fa buf .
31.Sh RETURN VALUES
69e3a22f 32The call returns the count of characters placed in the buffer
931b8415
CL
33if it succeeds, or a -1 if an error occurs, placing the error
34code in the global variable
35.Va errno .
36.Sh ERRORS
37.Fn Readlink
e0220bda 38will fail if:
931b8415
CL
39.Bl -tag -width ENAMETOOLONG
40.It Bq Er ENOTDIR
69e3a22f 41A component of the path prefix is not a directory.
931b8415 42.It Bq Er EINVAL
b5984ffe 43The pathname contains a character with the high-order bit set.
931b8415 44.It Bq Er ENAMETOOLONG
b5984ffe
KM
45A component of a pathname exceeded 255 characters,
46or an entire path name exceeded 1023 characters.
931b8415 47.It Bq Er ENOENT
69e3a22f 48The named file does not exist.
931b8415 49.It Bq Er EACCES
b5984ffe 50Search permission is denied for a component of the path prefix.
931b8415 51.It Bq Er ELOOP
b5984ffe 52Too many symbolic links were encountered in translating the pathname.
931b8415 53.It Bq Er EINVAL
69e3a22f 54The named file is not a symbolic link.
931b8415 55.It Bq Er EIO
fd690c8b 56An I/O error occurred while reading from the file system.
931b8415
CL
57.It Bq Er EFAULT
58.Fa Buf
69e3a22f 59extends outside the process's allocated address space.
931b8415
CL
60.El
61.Sh SEE ALSO
62.Xr stat 2 ,
63.Xr lstat 2 ,
64.Xr symlink 2
65.Sh HISTORY
66The
67.Nm
68function call appeared in
69.Bx 4.2 .