explain_setreuid_or_die(3)
π explain_setreuid_or_die(3) π
okay bestie, welcome to the explain_setreuid_or_die page β it lives in the Library Functions Manual and it's genuinely one of the most helpful little gremlins in libexplain. sit down, grab a boba, we're doing syscalls π§β¨
β¨ NAME β¨
explain_setreuid_or_die β set the real and effective user ID and report errors π«Ά
πΈ SYNOPSIS πΈ
#include <libexplain/setreuid.h>
void explain_setreuid_or_die(uid_t ruid, uid_t euid);
int explain_setreuid_on_error(uid_t ruid, uid_t euid);
π DESCRIPTION π
so there's two functions here and they're basically siblings, right? both of them wrap the setreuid(2) system call, and both of them are obsessed with telling you what went wrong.
explain_setreuid_or_die β this one calls the setreuid(2) system call. if it fails, it prints an explanation to stderr (which it gets from the explain_setreuid(3) function, iconic), and then the process terminates by calling exit(EXIT_FAILURE). like. it does not come back. it's giving dramatic exit, no notes. π
explain_setreuid_on_error β same deal, it calls setreuid(2) too. on failure it also prints an explanation to stderr (also courtesy of explain_setreuid(3)), but then it's chill and still returns to the caller. main character energy but polite. π
and the args, since you're gonna ask:
ruidβ the ruid, exactly as to be passed to thesetreuid(2)system call. don't get cute with it.euidβ the euid, exactly as to be passed to thesetreuid(2)system call. same energy, same rule. β¨
π RETURN VALUE π
explain_setreuid_or_die only returns on success β and for the deets on that, go read setreuid(2). on failure it prints an explanation and exits, so like... it does not return. at all. not even a little. π«
explain_setreuid_on_error always returns the value returned by the wrapped setreuid(2) system call. no cap. π
π¦ EXAMPLE π¦
the explain_setreuid_or_die function is intended to be used in a fashion similar to the following example:
explain_setreuid_or_die(ruid, euid);
that's it. that's the whole vibe. slay. π β¨
π SEE ALSO π
setreuid(2)β set the real and effective user IDexplain_setreuid(3)β explainsetreuid(2)errorsexit(2)β terminate the calling process
π COPYRIGHT π
libexplain version 1.4 Copyright (C) 2012 Peter Miller
okay and that's the whole page, bestie π₯Ήπ the footer down there just says explain_setreuid_or_die(3) again (the manual name, back for an encore), and everything above came to you from libexplain version 1.4, Copyright (C) 2012 Peter Miller. go forth and set those user IDs responsibly. 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) 2012 Peter Miller
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms