DragonFly On-Line Manual Pages
__REALPATH(2) DragonFly System Calls Manual __REALPATH(2)
NAME
__realpath - resolves the canonicalized absolute pathname
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
int
__realpath(const char * restrict pathname, char * restrict resolved_path,
size_t len);
DESCRIPTION
The __realpath() system call is used to support the libc realpath()
library call. It basically does the same thing but with a lower-level
system-call compatible API. The system call differs from the libc
function as follows: It requires that the target buffer and the size of
the target buffer be supplied, it does not (obviously) allocate a target
buffer if NULL is supplied, and it returns the string length of the
target buffer (not including the terminator) or -1. If a failure occurs,
the target buffer will not be modified (whereas it is in the libc
function).
The system call resolves all symbolic links, extra "/" characters and
references to /./ and /../ in pathname, and copies the resulting absolute
pathname into the memory pointed to by resolved_path. The resolved_path
argument must point to a buffer capable of storing at least len
characters, and may not be NULL.
The __realpath() function will resolve both absolute and relative paths
and return the absolute pathname corresponding to pathname. All
components of pathname must exist when __realpath() is called, and all
but the last component must name either directories or symlinks pointing
to the directories.
RETURN VALUES
The realpath() function returns the string length of the path stored in
the target buffer, not including the terminator, or -1 on failure.
ERRORS
The function may fail and set the external variable errno for any of the
errors specified for the library function realpath(3).
SEE ALSO
realpath(3)
HISTORY
The __realpath() function first appeared in DragonFly 5.7.
CAVEATS
This is the system call version of the libc realpath() function, but is
not a replacement for the libc function due to necessary API differences.
DragonFly 5.9-DEVELOPMENT February 2, 2020 DragonFly 5.9-DEVELOPMENT