EXPLAIN_SETGROUPS_OR_DIE(3)

πŸ“¦
version 1.4.D001 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute

πŸ’– explain_setgroups_or_die(3) πŸ’–

okay bestie, so this one lives in the Library Functions Manual, and it's giving "I wrap setgroups(2) for you and I will NOT let you fumble the error handling." let's get into it 🫢


✨ NAME ✨

explain_setgroups_or_die β€” set supplementary group IDs and report errors πŸ’…


🌸 SYNOPSIS 🌸

#include <libexplain/setgroups.h>
void explain_setgroups_or_die(size_t data_size, const gid_t *data);
int explain_setgroups_on_error(size_t data_size, const gid_t *data);

πŸ¦‹ DESCRIPTION πŸ¦‹

so the explain_setgroups_or_die function is literally just here to call the setgroups(2) system call for you. and when it fails? it prints an explanation to stderr β€” obtained from the explain_setgroups(3) function β€” and then the process terminates by calling exit(EXIT_FAILURE). no coming back from that one, periodt. πŸ’€

the explain_setgroups_on_error function also calls the setgroups(2) system call. on failure it prints an explanation to stderr, obtained from the explain_setgroups(3) function too β€” but this one is chill, it still returns to the caller. no exit, just vibes. ✨

  • data_size β€” the data_size, exactly as to be passed to the setgroups(2) system call. exactly. no notes. πŸŽ€
  • data β€” the data, exactly as to be passed to the setgroups(2) system call. same energy. πŸŽ€

πŸ‘‘ RETURN VALUE πŸ‘‘

the explain_setgroups_or_die function only returns on success β€” peep setgroups(2) for more info on that. on failure, it prints an explanation and exits, it does not return. like, at all. bye. 🫢

the explain_setgroups_on_error function always returns the value return by the wrapped setgroups(2) system call. always. fr fr. πŸ’œ


🌈 EXAMPLE 🌈

the explain_setgroups_or_die function is intended to be used in a fashion similar to the following example:

explain_setgroups_or_die(data_size, data);

iconic. short. slays. πŸŽ€


⭐ SEE ALSO ⭐


libexplain version 1.4 Copyright (C) 2009 Peter Miller

and that's the whole page bestie, no cap 🧚 this was explain_setgroups_or_die(3) from libexplain version 1.4, Copyright (C) 2009 Peter Miller β€” mwah, go handle your group IDs responsibly πŸ’…πŸ’–

πŸ“¦ where this page comes from