explain_lchownat_or_die(3)
π explain_lchownat_or_die(3) π
okay bestie, so this is a page from the Library Functions Manual and it's all about explain_lchownat_or_die β the glow-up wrapper around the lchownat(2) system call that catches errors and explains them instead of leaving you confused and crying. π«Ά
β¨ NAME β¨
explain_lchownat_or_die β Execute lchownat(2) and report errors π
π SYNOPSIS π
#include <libexplain/lchownat.h>
void explain_lchownat_or_die(int fildes, const char *pathname, int uid,
int gid);
int explain_lchownat_on_error(int fildes, const char *pathname, int uid,
int gid);
π¦ DESCRIPTION π¦
so like, there are two functions here and they're sisters, not twins, okay? let's get into it.
The explain_lchownat_or_die function is used to call the lchownat(2) system call. and the way it works? if it fails, an explanation gets printed to stderr, obtained from the explain_lchownat(3) function, and then the process terminates by calling exit(EXIT_FAILURE). yeah. it does not play. π
The explain_lchownat_on_error function is also used to call the lchownat(2) system call. On failure an explanation will be printed to stderr, obtained from the explain_lchownat(3) function β but this one is chill, it still returns to the caller. π§
now for the arguments, one by one, no skipping:
fildesβ The fildes, exactly as to be passed to thelchownat(2)system call. like, exactly. don't get creative.pathnameβ The pathname, exactly as to be passed to thelchownat(2)system call.uidβ The uid, exactly as to be passed to thelchownat(2)system call.gidβ The gid, exactly as to be passed to thelchownat(2)system call.
π RETURN VALUE π
The explain_lchownat_or_die function only returns on success β see lchownat(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 slay. if it doesn't... well. π
The explain_lchownat_on_error function always returns the value return by the wrapped lchownat(2) system call. always. periodt. π
β EXAMPLE β
The explain_lchownat_or_die function is intended to be used in a fashion similar to the following example:
explain_lchownat_or_die(fildes, pathname, uid, gid);
look at her. iconic. no error handling code, no nothing, she just handles it for you. main character energy fr fr. π₯
π SEE ALSO π
lchownat(2)β Executelchownat(2)explain_lchownat(3)β explainlchownat(2)errorsexit(2)β terminate the calling process
π COPYRIGHT π
libexplain version 1.4 Copyright (C) 2013 Peter Miller
okay that's the whole page bestie, you ate that reading session, no cap πβ¨πΈ and yes β this absolute gem comes to you courtesy of libexplain version 1.4, with Copyright (C) 2013 Peter Miller holding it down. that's a wrap, mwah π ππ¦
π¦ 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