Reads the contents of the specified symbolic link and places them into a user-supplied buffer. This function is supported on OpenVMS Integrity servers and Alpha only. Format #include <unistd.h> ssize_t readlink (const char *restrict link_name, char *restrict user_buffer, size_t buffer_size);
1 – Arguments
link_name Pointer to the text string representing the name of the symbolic link file. user_buffer Pointer to the user buffer. buffer_size Size of the user buffer.
2 – Description
The readlink function reads the contents of the specified symbolic link (link_name) and places them into a user-supplied buffer (user_buffer) of size (buffer_size). See also symlink, unlink, realpath, lchown, and lstat.
3 – Return Values
n Upon successful completion, the count of bytes placed in the user_buffer -1 Indicates an error. The buffer is unchanged, and errno is set to indicate the error: o EACCES - Read permission is denied in the directory where the symbolic link is being read, or search permission is denied for a component of the path prefix of link_name. o ENAMETOOLONG - The length of the link_name argument exceeds PATH_MAX, or a pathname component is longer than NAME_MAX. o Any errno value from close, open, or read.