READLINK(2) Linux Programmer's Manual READLINK(2)
NAME
readlink(1,2) - read(2,n,1 builtins) value of a symbolic link(1,2)
SYNOPSIS
#include <unistd.h>
int readlink(1,2)(const char *path, char *buf, size_t bufsiz);
DESCRIPTION
readlink(1,2) places the contents of the symbolic link(1,2) path in(1,8) the buffer
buf, which has size bufsiz. readlink(1,2) does not append a NUL character
to buf. It will truncate(2,7) the contents (to a length of bufsiz charac-
ters), in(1,8) case the buffer is too small to hold all of the contents.
RETURN VALUE
The call returns the count of characters placed in(1,8) the buffer if(3,n) it
succeeds, or a -1 if(3,n) an error(8,n) occurs, placing the error(8,n) code in(1,8) errno.
ERRORS
EACCES Search permission is denied for a component of the path prefix.
(See also path_resolution(2).)
EFAULT buf extends outside the process's allocated address space.
EINVAL bufsiz is not positive.
EINVAL The named(5,8) file(1,n) is not a symbolic link.
EIO An I/O error(8,n) occurred while reading from the file(1,n) system.
ELOOP Too many symbolic links were encountered in(1,8) translating the
pathname.
ENAMETOOLONG
A pathname, or a component of a pathname, was too long.
ENOENT The named(5,8) file(1,n) does not exist.
ENOMEM Insufficient kernel memory was available.
ENOTDIR
A component of the path prefix is not a directory.
CONFORMING TO
X/OPEN, 4.4BSD (the readlink(1,2) function call appeared in(1,8) 4.2BSD).
SEE ALSO
lstat(2), path_resolution(2), stat(1,2)(2), symlink(2)
Linux 2.0.30 1997-08-21 READLINK(2)