Open System Services System Calls Reference Manual (G06.25+, H06.03+)
readlink(2) OSS System Calls Reference Manual
NAME
readlink - Reads the value of a symbolic link
LIBRARY
G-series native Guardian processes: system library
G-series native OSS processes: system library
H-series native Guardian processes: implicit libraries
H-series OSS processes: implicit libraries
SYNOPSIS
#include <unistd.h>
int readlink(
const char *path,
char *buffer,
size_t buf_size);
PARAMETERS
path Specifies the pathname of the destination file or directory.
buffer Points to the user’s buffer. The buffer should be at least as large as the buf_size
parameter.
buf_size Specifies the size of the buffer.
If the actual length of the symbolic link is greater than the value of buf_size, the
symbolic link is truncated. The buffer specified by the buffer parameter contains
buf_size bytes of the link, and the value of the buf_size parameter is returned as
the value of the function.
If the actual length of the symbolic link is less than the value of buf_size, then
the contents of the buffer pointed to by the buffer parameter beyond the returned
value are undefined.
If the value of buf_size is 0 (zero), the contents of the buffer pointed to by the
buffer parameter are unchanged by the function call.
DESCRIPTION
The readlink( ) function places the contents of the symbolic link named by the path parameter in
buffer, which has size buf_size. If the actual length of the symbolic link is less than buf_size, the
string copied into the buffer is null-terminated.
For a readlink() function to finish successfully, the calling process must have execute (search)
permission for the directory containing the link.
Use on Guardian Objects
The readlink( ) function cannot be used on an object in the Guardian file system (/G). Symbolic
links cannot be created in /G.
Use From the Guardian Environment
The readlink( ) function can be used by a Guardian process when the process has been compiled
using the #define _XOPEN_SOURCE_EXTENDED 1 feature-test macro or an equivalent com-
piler command option.
The readlink( ) function is one of a set of functions that have the following effects when the first
of them is called from the Guardian environment:
• Two Guardian filesystem file numbers (not necessarily the next two available) are allo-
cated for the root directory and the current working directory. These file numbers cannot
be closed by calling the Guardian FILE_CLOSE_ procedure.
6−6 Hewlett-Packard Company 527186-003