REALPATH(3C) | Standard C Library Functions | REALPATH(3C) |
realpath - resolve pathname
#include <stdlib.h> char *realpath(const char *restrict file_name,
char *restrict resolved_name); char *canonicalize_file_name(const char *path);
The realpath() function derives, from the pathname pointed to by file_name, an absolute pathname that names the same file, whose resolution does not involve ".", "..", or symbolic links. The generated pathname is stored as a null-terminated string, up to a maximum of {PATH_MAX} bytes (defined in limits.h(3HEAD)), in the buffer pointed to by resolved_name.
The canonicalize_file_name() function is equivalent to calling realpath(path, NULL). This function is only provided for compatibility.
On successful completion, realpath() returns a pointer to the resolved name. Otherwise, realpath() returns a null pointer and sets errno to indicate the error, and the contents of the buffer pointed to by resolved_name are left in an indeterminate state.
The realpath() function will fail if:
EACCES
EINVAL
EIO
ELOOP
ELOOP
ENAMETOOLONG
ENOENT
ENOTDIR
The realpath() function may fail if:
ENAMETOOLONG
ENOMEM
The realpath() function operates on null-terminated strings.
Execute permission is required for all the directories in the given and the resolved path.
The realpath() function might fail to return to the current directory if an error occurs.
See attributes(7) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
Interface Stability | Standard |
MT-Level | MT-Safe |
getcwd(3C), sysconf(3C), limits.h(3HEAD), attributes(7), standards(7)
December 20, 2014 | OmniOS |