man.bsd.lv manual page server

Manual Page Search Parameters

__REALPATH(2) System Calls Manual __REALPATH(2)

__realpathresolves the canonicalized absolute pathname

library “libc”

int
__realpath(const char * restrict pathname, char * restrict resolved_path, size_t len);

The () system call is used to support the libc () 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 point to a buffer capable of storing at least len characters, and may not be NULL.

The () 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.

The realpath() function returns the string length of the path stored in the target buffer, not including the terminator, or -1 on failure.

The function may fail and set the external variable errno for any of the errors specified for the library function realpath(3).

realpath(3)

The __realpath() function first appeared in DragonFly 5.7.

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.

February 2, 2020 DragonFly-6.0.1