xref: /minix/minix/man/man2/readlink.2 (revision 7f5f010b)
READLINK 2 "March 17, 2006"
C 4
NAME
readlink - read the contents of a symlink
SYNOPSIS
#include <unistd.h>

int readlink(const char *path, char *buf, size_t bufsize)
DESCRIPTION
The readlink call reads the contents of the symlink name1 and returns it in buf up to a maximum of bufsize bytes. A terminating NUL byte is NOT put in the buffer.
"RETURN VALUE
Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error.
"ERRORS
Readlink will fail if one or more of the following are true:

15 [ENOTDIR] A component of either path prefix is not a directory.

15 [EINVAL] The path does not resolve to a symbolic link.

15 [ENAMETOOLONG] A path name exceeds PATH_MAX characters.

15 [ENOENT] A component of the path does not exist.

15 [EACCES] A component of the path denies search permission.

15 [ELOOP] Too many symbolic links were encountered in translating one of the pathnames.

15 [ENOENT] The link named by path does not exist.

15 [EFAULT] The buffer specified is outside the process's allocated address space.

"SEE ALSO"
symlink (2), unlink (2).