std.fs.readlink

std.fs

readlink(pathname) -> target, err

Read the target of a symbolic link

Returns the raw link target exactly as stored (does not resolve further symlinks or relative paths). Wraps readlink(2). Returns nil and an error string if path is not a symlink or cannot be read.

The magic links of /proc read whole: /proc/self/exe gives the running binary's path, and a /proc/<pid>/fd/<n> link its full target.