explain_nice(3)
π explain_nice(3) π
okay bestie, welcome to the explain_nice(3) page from the Library Functions Manual β we're about to make nice(2) errors make sense, and honestly? it's giving helpful. β¨
πΈ NAME πΈ
explain_nice β explain nice(2) errors π«Ά
π SYNOPSIS π
#include <libexplain/nice.h>
const char *explain_nice(int inc);
const char *explain_errno_nice(int errnum, int inc);
void explain_message_nice(char *message, int message_size, int inc);
void explain_message_errno_nice(char *message, int message_size, int
errnum, int inc);
π DESCRIPTION π
So like, these functions? They're the ones you call when you wanna get actual explanations for errors that the nice(2) system call handed back to you. no cap. π₯
β¨ explain_nice β¨
const char *explain_nice(int inc);
The explain_nice function is your girl for getting an explanation of an error that nice(2) returned. The absolute bare minimum the message will contain is the value of strerror(errno), but usually it does so much better than that and tells you the underlying cause in way more detail. obsessed. π
The errno global variable gets used to grab the error value that needs decoding.
incβ the originalinc, exactly as it was passed to thenice(2)system call. don't get cute with it, pass it as-is.
Returns:
The message explaining the error. This message buffer is shared by all libexplain functions that don't supply a buffer in their argument list. It will get overwritten by the next call to any libexplain function that shares this buffer β including calls from other threads. π
Note: This function is not thread safe, because it shares a return buffer across all threads, and so do many other functions in this library. like, it's a whole thing.
Example: This function is intended to be used in a fashion similar to the following example:
int result = nice(inc);
if (result < 0)
{
fprintf(stderr, "%s\n", explain_nice(inc));
exit(EXIT_FAILURE);
}
The above code example is available preβpackaged as the explain_nice_or_die(3) function. π
π explain_errno_nice π
const char *explain_errno_nice(int errnum, int inc);
The explain_errno_nice function is used to obtain an explanation of an error returned by the nice(2) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. main character energy fr fr. π
errnumβ the error value to be decoded, usually grabbed from theerrnoglobal variable right before this function gets called. This is necessary if you need to call any code between the system call you're explaining and this function, because a bunch of libc functions will alter the value oferrno. yes, they're messy like that. πincβ the originalinc, exactly as passed to thenice(2)system call.
Returns:
The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. π
Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. same vibes as before, sorry bestie.
Example: This function is intended to be used in a fashion similar to the following example:
int result = nice(inc);
if (result < 0)
{
int err = errno;
fprintf(stderr, "%s\n", explain_errno_nice(err, inc));
exit(EXIT_FAILURE);
}
The above code example is available preβpackaged as the explain_nice_or_die(3) function. π
π¦ explain_message_nice π¦
void explain_message_nice(char *message, int message_size, int inc);
The explain_message_nice function is used to obtain an explanation of an error returned by the nice(2) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. slay. β¨
The errno global variable will be used to obtain the error value to be decoded.
messageβ the location in which to store the returned message. If a suitable message return buffer is supplied, this function is thread safe. π«Άmessage_sizeβ the size in bytes of the location in which to store the returned message.incβ the originalinc, exactly as passed to thenice(2)system call.
Example: This function is intended to be used in a fashion similar to the following example:
int result = nice(inc);
if (result < 0)
{
char message[3000];
explain_message_nice(message, sizeof(message), inc);
fprintf(stderr, "%s\n", message);
exit(EXIT_FAILURE);
}
The above code example is available preβpackaged as the explain_nice_or_die(3) function. π
π§ explain_message_errno_nice π§
void explain_message_errno_nice(char *message, int message_size, int
errnum, int inc);
The explain_message_errno_nice function is used to obtain an explanation of an error returned by the nice(2) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. ate, no crumbs. π₯
messageβ the location in which to store the returned message. If a suitable message return buffer is supplied, this function is thread safe. πmessage_sizeβ the size in bytes of the location in which to store the returned message.errnumβ the error value to be decoded, usually obtained from theerrnoglobal variable just before this function is called. This is necessary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value oferrno. (they really do, keep an eye on them π)incβ the originalinc, exactly as passed to thenice(2)system call.
Example: This function is intended to be used in a fashion similar to the following example:
int result = nice(inc);
if (result < 0)
{
int err = errno;
char message[3000];
explain_message_errno_nice(message, sizeof(message), err,
inc);
fprintf(stderr, "%s\n", message);
exit(EXIT_FAILURE);
}
The above code example is available preβpackaged as the explain_nice_or_die(3) function. π
π SEE ALSO π
nice(2)β change process priority πexplain_nice_or_die(3)β change process priority and report errors π«
π COPYRIGHT π
libexplain version 1.4 Copyright (C) 2009 Peter Miller
and that's the whole page bestie, we ate and left zero crumbs π β¨
iykyk β this was explain_nice(3) from libexplain version 1.4, copyright (C) 2009 Peter Miller. go forth and explain your errors, gorgeous ππ¦
π¦ 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) 2009-2011 Peter Miller
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms