explain_fchmod_or_die(3)
β¨ explain_fchmod_or_die β¨
okay bestie, so this one lives in the Library Functions Manual section 3, and it's called explain_fchmod_or_die π it's giving "change permissions of an open file and report errors" β like, the whole point is that when stuff goes wrong, you get an actual explanation instead of just vibes and a mystery errno π«Ά
πΈ NAME πΈ
explain_fchmod_or_die β change permissions of an open file and report errors π
π SYNOPSIS π
#include <libexplain/fchmod.h>
void explain_fchmod_or_die(int fildes, mode_t mode);
int explain_fchmod_on_error(int fildes, mode_t mode);
π¦ DESCRIPTION π¦
so, the explain_fchmod_or_die function is literally just there to call the fchmod(2) system call for you β¨ and if it fails? an explanation gets printed to stderr, sourced from the explain_fchmod(3) function, and then the process terminates by calling exit(EXIT_FAILURE). like, it's not coming back. it's done. periodt π
the explain_fchmod_on_error function also calls the fchmod(2) system call, and on failure it also prints an explanation to stderr from explain_fchmod(3) β but this one is polite and still returns to the caller π§ no dramatic exit, no main character finale, just "here's what happened, carry on" π
fildesβ the fildes, exactly as to be passed to thefchmod(2)system call. like, don't get cute with it, pass it as-is πmodeβ the mode, exactly as to be passed to thefchmod(2)system call. same energy, no remixing π₯
β RETURN VALUE β
the explain_fchmod_or_die function only returns on success β check fchmod(2) for more info, bestie. on failure it prints an explanation and exits, so it literally does not return. not a single return. zero returns. the way that it just leaves π
the explain_fchmod_on_error function always returns the value returned by the wrapped fchmod(2) system call π«
π EXAMPLE π
the explain_fchmod_or_die function is intended to be used in a fashion similar to the following example, iykyk:
explain_fchmod_or_die(fildes, mode);
π SEE ALSO π
fchmod(2)β change permissions of an open file πΈexplain_fchmod(3)β explainfchmod(2)errors π¦exit(2)β terminate the calling process π
π COPYRIGHT π
libexplain version 1.4 Copyright (C) 2013 Peter Miller
and that's the whole page, bestie π no cap, that's everything β every flag, every value, every warning, all of it, untouched and iconic. this was explain_fchmod_or_die(3) from the Library Functions Manual, and the sign-off credits go to libexplain version 1.4, Copyright (C) 2013 Peter Miller β mwah, slay, go chmod something responsibly πβ¨π«Ά
π¦ 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