DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

readlink(S)


readlink -- read the value of a symbolic link

Synopsis

   #include <unistd.h>
   

int readlink(const char *path, void *buf, size_t 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

On success, readlink returns the number of characters placed in the buffer. On failure, readlink returns -1, sets errno to identify the error, and the buffer remains unchanged.

In the following conditions, readlink fails and sets errno to:


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

EACCES
Read permission is denied on the file named by path.

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

EINVAL
The named file is not a symbolic link.

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

ELOOP
Too many symbolic links are encountered in translating path.

ENAMETOOLONG
The length of the path argument exceeds {PATH_MAX}, or the length of a path component exceeds {NAME_MAX} while _POSIX_NO_TRUNC is in effect.

ENOENT
The named file does not exist.

ENOSYS
The file system does not support symbolic links.

References

realpath(S), stat(S), symlink(S)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005