readlink(2)
NAME
readlink − read value of a symbolic link
SYNOPSIS
#include <symlink.h>
ssize_t readlink(
const char *path,
char *buf,
size_t bufsiz
);
DESCRIPTION
readlink() obtains the path name pointed to by the symbolic link, path. This path name is placed in the buffer buf, which has size bufsiz.
RETURN VALUE
If readlink() succeeds, it returns the count of characters placed in the buffer. If an error occurs, it returns −1 and sets errno to indicate the error.
ERRORS
readlink() fails if any of the following conditions is encountered:
[ENOTDIR] A component of the path prefix is not a directory.
[ENAMETOOLONG] A component of path exceeds bytes while is in effect, or path exceeds bytes.
[ENOENT] The named file does not exist.
[EACCES] Search permission is denied for a component of the path prefix.
[ELOOP] Too many symbolic links were encountered in translating the path name.
[EINVAL] The named file is not a symbolic link.
[EFAULT] buf points outside the process’ allocated address space. Reliable detection of this error is implemenation dependent.
DEPENDENCIES
Series 300,400, and 700:
If the length of the path name string is less than bufsiz, the string will be null terminated when returned. If the length of the path name string is exactly bufsiz, the string will not be null terminated when returned. If the length of the path name string exceeds bufsiz, readlink() returns −1 and sets errno to:
[ERANGE] The length of the path name string read from the symbolic link exceeds bufsiz.
Series 800:
The path name is not null terminated when returned.
AUTHOR
readlink() was developed by the University of California, Berkeley.
SEE ALSO
stat(2), lstat(2), symlink(2), symlink(4).
STANDARDS CONFORMANCE
readlink(): AES [Series 300/400/700 only]
Hewlett-Packard Company — HP-UX Release 9.0: August 1992