readlink(2)
_________________________________________________________________
readlink System Call
Read the contents of a symbolic link.
_________________________________________________________________
SYNTAX
int readlink (path, buffer, nbyte)
char * path;
char * buffer;
int nbyte;
PARAMETERS
path Address of a pathname naming a symbolic link.
buffer User data buffer.
nbyte Size (in bytes) of the user data buffer.
DESCRIPTION
<Path> points to a pathname naming a symbolic link file. That
is, the last component of the pathname is a symbolic link file,
and the pathname resolution does not follow the symbolic link.
Readlink reads at most the first <nbytes> of the symbolic link
file into the buffer pointed to by <buffer>.
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
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
readlink(2)
<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.
EXCEPTIONS
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.
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.
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)
readlink(2)
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
The related manual sections: lstat(2), stat(2), symlink(2).
DG/UX 4.00 Page 3
Licensed material--property of copyright holder(s)