EXPLAIN_GETRESUID_OR_DIE(3)
π explain_getresuid_or_die(3) β Library Functions Manual π
okay bestie, sit down, hydrate, and let me tell you about this iconic little libexplain page. it lives in section 3, it's part of Library Functions Manual, and it's here to make sure you get your r/e/s user IDs and find out loudly when the universe says no. no cap. β¨
πΈ NAME πΈ
explain_getresuid_or_die β get r/e/s user IDs and report errors
literally what it says on the tin, bestie. you want the IDs, and if it goes wrong you want to know, dramatically, with an explanation. π
β¨ SYNOPSIS β¨
#include <libexplain/getresuid.h>
void explain_getresuid_or_die(uid_t *ruid, uid_t *euid, uid_t *suid);
int explain_getresuid_on_error(uid_t *ruid, uid_t *euid, uid_t *suid);
look at those two functions. two sisters. two vibes. one of them does NOT come back. π
π« DESCRIPTION π«
so here's the tea. π
The explain_getresuid_or_die function is used to call the getresuid(2) system call. On failure an explanation will be printed to stderr, obtained from the explain_getresuid(3) function, and then the process terminates by calling exit(EXIT_FAILURE).
not me calling exit like that π bestie it is GONE. it does not return. that's not a bug, that's the whole point. main character energy, but make it fatal.
The explain_getresuid_on_error function is used to call the getresuid(2) system call. On failure an explanation will be printed to stderr, obtained from the explain_getresuid(3) function, but still returns to the caller.
this one is the chill sibling 𫢠it tells you what went wrong and then just⦠hands the control back. respectful. considerate. we love her.
and now the arguments, one by one, no skipping, we don't do that here:
ruidβ Theruid, exactly as to be passed to thegetresuid(2)system call.euidβ Theeuid, exactly as to be passed to thegetresuid(2)system call.suidβ Thesuid, exactly as to be passed to thegetresuid(2)system call.
yeah they're all "exactly as to be passed" β you don't get to be clever with them, you pass them straight through, periodt. π
π¦ RETURN VALUE π¦
The explain_getresuid_or_die function only returns on success, see getresuid(2) for more information. On failure, prints an explanation and exits, it does not return.
fr fr. if you're writing code after that call expecting it to come back on failure, i'm gonna hold your hand when i say this: it won't. π
The explain_getresuid_on_error function always returns the value return by the wrapped getresuid(2) system call.
so like, whatever getresuid(2) said, she says. she's a messenger, not a narrator. π
π EXAMPLE π
The explain_getresuid_or_die function is intended to be used in a fashion similar to the following example:
explain_getresuid_or_die(ruid, euid, suid);
that's it. that's the whole move. three pointers, one line, slay. β¨
π SEE ALSO π
the besties you should also go read, because iykyk:
getresuid(2)β get real, effective and saved user IDsexplain_getresuid(3)β explaingetresuid(2)errorsexit(2)β terminate the calling process
π COPYRIGHT π
libexplain version 1.4 Copyright (C) 2012 Peter Miller
and that's the page, bestie!! π this whole thing came to you courtesy of libexplain version 1.4, dated 2012 β shoutout Peter Miller for the copyright, and the footer is repping explain_getresuid_or_die(3) one more time because she deserves the encore. π¦π
β¨
π¦ 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) 2012 Peter Miller
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms