FHREADLINK(2)
π FHREADLINK(2) β like, the manual page for fhreadlink π
okay so bestie, welcome to FHREADLINK(2), a real one from the System Calls Manual section 2. yes it's a syscall page. yes it's about reading symbolic links. yes we're gonna have fun with it. β¨
πΈ NAME πΈ
fhreadlink β read value of a symbolic link
π LIBRARY π
Standard C Library (libc, -lc)
like, that's where it lives. you link -lc and you're in. π«Ά
β¨ SYNOPSIS β¨
#include <sys/param.h>
#include <sys/mount.h>
int
fhreadlink(fhandle_t *fhp, char *buf, size_t bufsize);
look at her. three args, one int return, two headers. no notes. π
π DESCRIPTION π
The fhreadlink() system call places the contents of the symbolic link fhp in the buffer buf, which has size bufsiz.
(and yes, bestie, we said bufsiz up there and bufsize in the synopsis. that's literally how the page is written. iconic of it, honestly. π)
The fhreadlink() system call does not append a NUL character to buf. no cap. so like, don't go treating that buffer as a C string unless you're adding your own terminator, because she will not do it for you. π«
π₯ RETURN VALUES π₯
The call returns the count of characters placed in the buffer if it succeeds, or a -1 if an error occurs, placing the error code in the global variable errno.
so: positive-ish number of chars = slay. -1 = check errno, bestie. π
π€ ERRORS π€
The readlink() system call will fail if:
[ENOENT]β The named file does not exist. it's giving "girl where". π[ELOOP]β Too many symbolic links were encountered in translating the file handlefhp. a loop of links. an ouroboros of links. we are NOT doing that today. π[EINVAL]β The named file is not a symbolic link. wrong vibe entirely. not a symlink, not our problem. π[EIO]β An I/O error occurred while reading from the file system. the disk said "not right now". π[EINTEGRITY]β Corrupted data was detected while reading from the file system. the data is lying to you, do not trust her. π©[EFAULT]β Thebufargument extends outside the process's allocated address space. your pointer wandered off the map, bestie. πΊοΈ[ESTALE]β The file handlefhpis no longer valid. expired. stale. like that one situationship. π
(also yes, the page literally says "Thereadlink()system call will fail if:" up there even though we're all here forfhreadlink(). we don't ask questions, we just report the facts. π«‘)
π SEE ALSO π
(trailing comma included because I am nothing if not faithful to the source. periodt. π )
π the cute sign-off π
this page came to you courtesy of Debian, dated March 30, 2020, and it's filed under FHREADLINK(2) in the System Calls Manual. that's the whole footer, bestie, and I have delivered it with love. go read some symlinks. ππ¦β¨
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- π the page's license: BSD-2-Clause
- Copyright (c) 2018 Gandi
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms