readlink(2) DG/UX 5.4.2 readlink(2)
NAME
readlink - read the contents of a symbolic link
SYNOPSIS
#include <unistd.h>
int readlink (path, buffer, nbyte)
char * path;
char * buffer;
int nbyte;
where:
path Address of a pathname naming a symbolic link
buffer User data buffer
nbyte Size (in bytes) of the user data buffer
DESCRIPTION
Readlink reads at most the first nbytes of the symbolic link file
into the buffer pointed to by buffer. The last component of path is
a symbolic link file, and the pathname resolution does not follow the
symbolic link.
A terminating null character is not added to the end of the link
contents (or to the end of the buffer, should the buffer size be less
than the size of the symbolic link file). Hence, readlink's return
value, the number of characters placed in the buffer, is the only
clue the process has to how much of buffer contains valid data.
If readlink fails, the contents of the buffer are undefined.
ACCESS CONTROL
The calling process must have permission to resolve path.
RETURN VALUE
nbyte Completed successfully. The number of characters
placed in the buffer is returned. No determination
can be made as to whether the entire contents of the
symbolic link file have been read.
0..nbyte-1 Completed successfully. The number of characters
placed in the buffer is returned.
-1 An error occurred. errno is set to indicate the
error.
DIAGNOSTICS
Errno may be set to one of the following error codes:
EFAULT Buffer extends outside the process's allocated address
space.
ENOENT The named file does not exist.
Licensed material--property of copyright holder(s) 1
readlink(2) DG/UX 5.4.2 readlink(2)
EINVAL The named file is not a symbolic link.
EPERM Permission to read the symbolic link is denied to the
calling process.
ENOENT The file the pathname resolved to does not exist.
ENOENT A non-terminal component of the pathname does not
exist.
ENOTDIR A non-terminal component of the pathname was not a
directory or symbolic link.
ENAMETOOLONG The pathname exceeds the length limit for pathnames.
ENAMETOOLONG A component of the pathname exceeds the length limit
for filenames.
ENOMEM There are not enough system resources to resolve the
pathname or to expand a symbolic link.
ELOOP The number of symbolic links encountered during
pathname resolution exceeded MAXSYMLINKS. A symbolic
link cycle is suspected.
EPERM The pathname contains a character not in the allowed
character set.
SEE ALSO
lstat(2), stat(2), symlink(2).
Licensed material--property of copyright holder(s) 2