Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

readlink(2)

getwd(3)

REALPATH(3)  —  C LIBRARY FUNCTIONS

NAME

realpath − return the canonicalized absolute pathname

SYNOPSIS

#include <sys/param.h>

char ∗realpath(path, resolved_path)
char ∗path;
char resolved_path[MAXPATHLEN];

DESCRIPTION

realpath() expands all symbolic links and resolves references to ’/./’, ’/../’ and extra ’/’ characters in the null terminated string named by path and stores the canonicalized absolute pathname in the buffer named by resolved_path. The resulting path will have no symbolic links components, nor any ’/./’ or ’/../’ components.

RETURN VALUES

realpath() returns a pointer to the resolved_path on success.  On failure, it returns NULL, sets errno to indicate the error, and places in resolved_path the absolute pathname of the path component which could not be resolved. 

ERRORS

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

EFAULT resolved_path extends outside the process’s allocated address space. 

ELOOP Too many symbolic links were encountered in translating path.

EINVAL path or resolved_path was NULL. 

EIO An I/O error occurred while reading from or writing to the file system. 

ENAMETOOLONG The length of the path argument exceeds {PATH_MAX}. 

A pathname component is longer than {NAME_MAX} (see sysconf(2V)) while {_POSIX_NO_TRUNC} is in effect (see pathconf(2V)). 

ENOENT The named file does not exist. 

SEE ALSO

readlink(2), getwd(3)

WARNINGS

It indirectly invokes the readlink(2) system call and getwd(3) library call (for relative path names), and hence inherits the possibility of hanging due to inaccessible file system resources. 

Sun Release 4.1  —  Last change: 21 January 1990

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026