Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > R


HP-UX 11i Version 3: February 2007

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index


readlink() — read the contents of a symbolic link


#include <symlink.h> int readlink( const char *path, char *buf, size_t bufsiz );


The readlink() function places the contents of the symbolic link referred to by path in the buffer buf which has size bufsiz. If the number of bytes in the symbolic link is less than bufsiz, the contents of the remainder of buf are unspecified.

In systems conforming to AES standards, the returned string will be null-terminated if the length of the path name string is less than bufsiz. If the length of the path name string is exactly bufsiz, the string will not be null-terminated when returned. If the length of the path name string exceeds bufsiz, the readlink() function returns -1 and sets errno to ERANGE.


The kernel tunable parameter hpux_aes_override can be queried to determine whether a system conforms to AES standards.


Upon successful completion, readlink() returns the count of bytes placed in the buffer. Otherwise, it returns a value of -1, leaves the buffer unchanged, and sets errno to indicate the error.


The readlink() function will fail if:


Search permission is denied for a component of the path prefix.


Read permission is denied for the directory.


buf or path points outside the process's allocated address space. Reliable detection of this error is implementation-dependent.


The path argument names a file that is not a symbolic link.


An I/O error occurred while reading from the file system.


Too many symbolic links were encountered in resolving path.


The length of path exceeds PATH_MAX, or a pathname component is longer than NAME_MAX. In systems conforming to AES standards, this error will be returned when the path exceeds the PATH_MAX bytes or a pathname component exceeds the NAME_MAX bytes while _POSIX_NO_TRUNC is in effect.


Pathname resolution of a symbolic link produced an intermediate result whose length exceeds PATH_MAX.


A component of path does not name an existing file or path is an empty string.


A component of the path prefix is not a directory.


The length of the path name string read from the symbolic link exceeds bufsiz.


readlink() was developed by the University of California, Berkeley.


stat(2), symlink(2), symlink(4), privileges(5), <unistd.h>.


readlink() : AES, SVID3

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.