EXPLAIN_SETRESGID_OR_DIE(3)
π explain_setresgid_or_die β Library Functions Manual π
okay bestie, welcome to explain_setresgid_or_die(3), the libexplain glow-up that lets you set your real / effective / saved group IDs and actually hear about it when it goes wrong instead of justβ¦ silently perishing. we love a communicative icon. π«Ά
β¨ NAME β¨
explain_setresgid_or_die β set r/e/s group ID and report errors
πΈ SYNOPSIS πΈ
#include <libexplain/setresgid.h>
void explain_setresgid_or_die(gid_t rgid, gid_t egid, gid_t sgid);
int explain_setresgid_on_error(gid_t rgid, gid_t egid, gid_t sgid);
π¦ DESCRIPTION π¦
so. the explain_setresgid_or_die function is the main character here β it calls the setresgid(2) system call for you. and if that call fails? it prints a whole explanation to stderr, snatched straight from the explain_setresgid(3) function, and then the process literally terminates by calling exit(EXIT_FAILURE). no cap, it does not come back. π
meanwhile, explain_setresgid_on_error is the chiller sibling. it also calls the setresgid(2) system call, and on failure it also prints an explanation to stderr obtained from the explain_setresgid(3) function β but then it justβ¦ returns to the caller. it's giving emotionally available. π
now the arguments, one by one, no skipping:
rgidβ the rgid, exactly as to be passed to thesetresgid(2)system call.egidβ the egid, exactly as to be passed to thesetresgid(2)system call.sgidβ the sgid, exactly as to be passed to thesetresgid(2)system call.
like, exactly exactly. don't get cute with them. π
π RETURN VALUE π
- the
explain_setresgid_or_diefunction only returns on success β seesetresgid(2)for more info on what that success even means. on failure it prints an explanation and exits. it does not return. periodt. π - the
explain_setresgid_on_errorfunction always returns the value return by the wrappedsetresgid(2)system call.
π EXAMPLE π
the explain_setresgid_or_die function is intended to be used in a fashion similar to the following example:
explain_setresgid_or_die(rgid, egid, sgid);
look at that. one line. flawless. iconic. π
π SEE ALSO π
setresgid(2)β set real, effective and saved group IDexplain_setresgid(3)β explainsetresgid(2)errorsexit(2)β terminate the calling process
β COPYRIGHT β
libexplain version 1.4 Copyright (C) 2012 Peter Miller
and that's the whole page, bestie π this was explain_setresgid_or_die(3) from the Library Functions Manual β libexplain version 1.4, Copyright (C) 2012 Peter Miller, and yes the footer is slaying just as hard as the header. 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