explain_se...ity_or_die(3)

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

✨ NAME ✨</p>

explain_setpriority_or_die β€” bestie, this is the one that sets your program's scheduling priority and then tells you exactly what went wrong if it can't. πŸ’…


🌸 SYNOPSIS 🌸

#include <libexplain/setpriority.h>
void explain_setpriority_or_die(int which, int who, int prio);
int explain_setpriority_on_error(int which, int who, int prio);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so listen. πŸ’– There are two functions here and they're sisters, not twins.

explain_setpriority_or_die

This one is the main character. It calls the setpriority(2) system call for you. If everything goes right, slay, we move. But if it fails? An explanation gets printed to stderr, and that explanation comes from the explain_setpriority(3) function, and then the process terminates by calling exit(EXIT_FAILURE). Like, it does not come back. It's giving dramatic exit. πŸ’€

explain_setpriority_on_error

This one is the chill sister. It also calls setpriority(2). If it fails, an explanation is printed to stderr (again obtained from the explain_setpriority(3) function) β€” but then it still returns to the caller. No exit, no drama, just vibes and a returned error. 🫢


The arguments, babes

  • which β€” the which, exactly as to be passed to the setpriority(2) system call. No edits, no notes, just pass it through.
  • who β€” the who, exactly as to be passed to the setpriority(2) system call. Same deal.
  • prio β€” the prio, exactly as to be passed to the setpriority(2) system call. You already know. ✨

πŸ’– RETURN VALUE πŸ’–

explain_setpriority_or_die β€” bestie, it only returns on success. That's it. See setpriority(2) for more info if you're curious. On failure it prints an explanation and exits β€” it does not return. Ever. Periodt. πŸ’…

explain_setpriority_on_error β€” this one always returns the value returned by the wrapped setpriority(2) system call. Always. Every time. Iconic behaviour honestly.


πŸŽ€ EXAMPLE πŸŽ€

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

explain_setpriority_or_die(which, who, prio);

that's it. that's the whole vibe. 🌸


🌈 SEE ALSO 🌈


libexplain version 1.4 Copyright (C) 2013 Peter Miller


okay that's the whole page, bestie!! πŸ¦‹βœ¨ this one lives in the Library Functions Manual and it's explain_se...ity_or_die(3) β€” go forth and set those priorities responsibly, mwah πŸ’…πŸ’–

πŸ“¦ where this page comes from