readlink(2) DG/UX R4.11MU05 readlink(2)
NAME
readlink - read the contents of a symbolic link
SYNOPSIS
#include <unistd.h>
int readlink (path, buffer, nbyte)
constant 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. On a system
with DG/UX Information Security, the calling process must also have
read access to 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:
EACCES The calling process lacks read access to the pathname
(trusted systems only).
EFAULT Buffer extends outside the process's allocated address
space.
EINVAL The named file is not a symbolic link.
ELOOP The number of symbolic links encountered during
pathname resolution exceeded MAXSYMLINKS. A symbolic
link cycle is suspected.
ENAMETOOLONG The pathname exceeds the length limit for pathnames.
ENAMETOOLONG A component of the pathname exceeds the length limit
for filenames.
ENOENT The file the pathname resolved to does not exist.
ENOENT A non-terminal component of the pathname does not
exist.
ENOMEM There are not enough system resources to resolve the
pathname or to expand a symbolic link.
ENOTDIR A non-terminal component of the pathname was not a
directory or symbolic link.
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)