READLINK(2)

NAME
readlink - read value of a symbolic link

SYNOPSIS

int readlink(path, buf, bufsiz)
char *path, *buf;
int bufsiz;

DESCRIPTION

readlink() places the contents of the symbolic link referred to by path in the buffer buf which has size bufsiz. The contents of the link are not null terminated when returned.

RETURN VALUES

readlink() returns the number of characters placed in the buffer on success. On failure, it returns -1 and sets errno to indicate the error.

ERRORS

readlink() will fail and the buffer will be unchanged if:

EACCES
    Search permission is denied for a component of the path prefix of path.

EFAULT
    path or buf extends outside the process's allocated address space.

ELOOP
    Too many symbolic links were encountered in translating path.

EINVAL
    The named file is not a symbolic link.

EIO An I/O error occurred while reading from or writing to the file system.

ENAMETOOLONG
    The length of the path argument exceeds {PATH_MAX}.

    A pathname component is longer than {NAME_MAX} (see sysconf(2V)) while {_POSIX_NO_TRUNC} is in effect (see pathconf(2V)).

ENOENT
    The named file does not exist.

SEE ALSO
stat(2V), symlink(2)