explain_fchownat_or_die(3)
π explain_fchownat_or_die(3) π
okay bestie, welcome to the Library Functions Manual section, and this one is literally about changing who owns a file β but relative to a directory, which is the β¨fancyβ¨ version. π¦
β¨ NAME β¨
explain_fchownat_or_die β change ownership of a file relative to a directory and report errors π
πΈ SYNOPSIS πΈ
#include <libexplain/fchownat.h>
void explain_fchownat_or_die(int dirfd, const char *pathname, int owner,
int group, int flags);
int explain_fchownat_on_error(int dirfd, const char *pathname, int
owner, int group, int flags);
π DESCRIPTION π
so there's these two little icons, right, and they both wrap the fchownat(2) system call. but they react to failure VERY differently, and that's the whole tea. β
The explain_fchownat_or_die function is used to call the fchownat(2) system call. On failure an explanation will be printed to stderr, obtained from the explain_fchownat(3) function, and then the process terminates by calling exit(EXIT_FAILURE). π like, it does NOT come back. it's giving dramatic exit, no notes.
The explain_fchownat_on_error function is used to call the fchownat(2) system call. On failure an explanation will be printed to stderr, obtained from the explain_fchownat(3) function, but still returns to the caller. π«Ά so chill. so forgiving. main character energy but polite.
now the parameters, one by one, no skipping:
dirfdβ Thedirfd, exactly as to be passed to thefchownat(2)system call. like, we're not touching it, we're just handing it over πpathnameβ Thepathname, exactly as to be passed to thefchownat(2)system call. same energy, verbatim β¨ownerβ Theowner, exactly as to be passed to thefchownat(2)system call. the new owner bestie πgroupβ Thegroup, exactly as to be passed to thefchownat(2)system call. the new group, matching set πflagsβ Theflags, exactly as to be passed to thefchownat(2)system call. all the little toggles, untouched π
β RETURN VALUE β
The explain_fchownat_or_die function only returns on success β see fchownat(2) for more information. On failure, prints an explanation and exits, it does not return. π so if it comes back to you, that's a W. if it doesn't... that was the point, fr fr.
The explain_fchownat_on_error function always returns the value return by the wrapped fchownat(2) system call. π yes, always. even the sad values. it's a whole vibe.
π EXAMPLE π
The explain_fchownat_or_die function is intended to be used in a fashion similar to the following example:
explain_fchownat_or_die(dirfd, pathname, owner, group, flags);
literally that's it. one line. ate. π
π§ SEE ALSO π§
fchownat(2)β change ownership of a file relative to a directoryexplain_fchownat(3)β explainfchownat(2)errorsexit(2)β terminate the calling process
iykyk, these three are the whole friend group. π
π COPYRIGHT π
libexplain version 1.4 Copyright (C) 2013 Peter Miller
okay that's the whole page bestie, and since we're at the very bottom, this is the cute sign-off: this little masterpiece lives in libexplain version 1.4, it's Copyright (C) 2013 Peter Miller, and the man page name tag it wears is explain_fchownat_or_die(3). π go forth and chown responsibly, no cap. πβ¨
π¦ where this page comes from
- debian bookworm: libexplain-dev 1.4.D001-12+b1 Β· LGPL-3.0-or-later
- debian trixie: libexplain-dev 1.4.D001-16 Β· LGPL-3.0-or-later
- ubuntu jammy: libexplain-dev 1.4.D001-12 Β· LGPL-3.0-or-later
- ubuntu noble: libexplain-dev 1.4.D001-13 Β· LGPL-3.0-or-later
- ubuntu resolute: libexplain-dev 1.4.D001-16 Β· LGPL-3.0-or-later
- Copyright (C) 2013 Peter Miller
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms