Index of Section 2 Manual Pages
| Interix / SUA | wcs_readlink.2 | Interix / SUA |
wcs_readlink(2) wcs_readlink(2)
readlink()
NAME
readlink(), wcs_readlink() - read the contents of a symbolic link
SYNOPSIS
#include
int readlink(const char *path, char *buf, size_t bufsize)
int wcs_readlink(const wchar_t *path, wchar_t *buf, size_t bufsize)
DESCRIPTION
The readlink(2) and wcs_readlink(2) functions are identical, except that
wcs_readlink(2) accepts wide characters in the path and buf arguments.
The readlink(2) and wcs_readlink(2) functions store the contents of the
symbolic link file path in the buffer buf, which is of size bufsize. On
Interix, the contents of buf are null-terminated, though portable programs
should not assume this is so.
If the symlink data are longer than bufsiz, then only the first bufsiz
bytes of the symlink data are written into the buffer, and the value
bufsiz is returned; errno is not set.
However, if you lstat(2) the symbolic link, then the st_size field is set
to the total number of bytes of symlink data.
RETURN VALUE
On success, the readlink(2) or wcs_readlink(2) call returns the number of
bytes stored in bufsize; otherwise it returns -1 and sets errno.
ERRORS
The readlink(2) call can fail for the following reasons:
[EACCES]
Process does not have permission to search some directory in the path.
[EINVAL]
The path is not a symbolic link file, or the file is on a device that
does not support the operation.
[EIO]
An I/O error occurred while reading from the filesystem.
[ENOENT]
Either path is an empty string or some component of path does not
exist.
[ELOOP]
Too many symbolic links were encountered in resolving path.
[ENAMETOOLONG]
The path is longer than {PATH_MAX} or some component of path is longer
than {NAME_MAX}, or the pathname resolution of a symbolic link
produced some intermediate result that was longer than {PATH_MAX}.
[ENOTDIR]
Some component of the prefix in path is not a directory.
USAGE NOTES
All of these functions are thread safe.
All of these functions are async-signal safe.