explain_getresuid(3)
π explain_getresuid β the manual, but make it make sense π
okay so bestie, you're looking at explain_getresuid(3) from the Library Functions Manual β it's a libexplain thing, and it exists to explain getresuid(2) errors to you like a bestie would. no cap.
β¨ NAME β¨
explain_getresuid β explain getresuid(2) errors πΈ
π¦ SYNOPSIS π¦
#include <libexplain/getresuid.h>
const char *explain_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid);
const char *explain_errno_getresuid(int errnum, uid_t *ruid, uid_t *euid, uid_t *suid);
void explain_message_getresuid(char *message, int message_size, uid_t *ruid, uid_t *euid, uid_t *suid);
void explain_message_errno_getresuid(char *message, int message_size, int errnum, uid_t *ruid, uid_t *euid, uid_t *suid);
π DESCRIPTION π
these functions? they're your little translators π
. you hit getresuid(2), it comes back mad, and one of these four hands you a human-readable explanation of what went wrong. it's giving "therapy for syscalls", honestly.
π explain_getresuid
const char *explain_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid);
explain_getresuid is your girl for getting an explanation of an error returned by the getresuid(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. it's the overachiever of the group, and we love that for it. π«Ά
the errno global variable will be used to obtain the error value to be decoded.
ruidβ the originalruid, exactly as passed to thegetresuid(2)system call. not a copy, not a vibe, the exact one.euidβ the originaleuid, exactly as passed to thegetresuid(2)system call.suidβ the originalsuid, exactly as passed to thegetresuid(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. it's giving "one communal hairbrush", bestie.
Example: this function is intended to be used in a fashion similar to the following example:
if (getresuid(ruid, euid, suid) < 0)
{
fprintf(stderr, "%s\n", explain_getresuid(ruid, euid, suid));
exit(EXIT_FAILURE);
}
the above code example is available pre-packaged as the explain_getresuid_or_die(3) function. β¨
πΈ explain_errno_getresuid
const char *explain_errno_getresuid(int errnum, uid_t *ruid, uid_t *euid, uid_t *suid);
explain_errno_getresuid is used to obtain an explanation of an error returned by the getresuid(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. same energy, but you hand it the errno yourself. π
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. so yeah, grab it early or it's gone, fr fr.ruidβ the originalruid, exactly as passed to thegetresuid(2)system call.euidβ the originaleuid, exactly as passed to thegetresuid(2)system call.suidβ the originalsuid, exactly as passed to thegetresuid(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.
Example: this function is intended to be used in a fashion similar to the following example:
if (getresuid(ruid, euid, suid) < 0)
{
int err = errno;
fprintf(stderr, "%s\n", explain_errno_getresuid(err, ruid, euid, suid));
exit(EXIT_FAILURE);
}
the above code example is available pre-packaged as the explain_getresuid_or_die(3) function. π¦
π explain_message_getresuid
void explain_message_getresuid(char *message, int message_size, uid_t *ruid, uid_t *euid, uid_t *suid);
explain_message_getresuid is used to obtain an explanation of an error returned by the getresuid(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. you bring your own buffer, and that's the whole glow-up here. π
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. yes bestie, YOU did that. πmessage_sizeβ the size in bytes of the location in which to store the returned message.ruidβ the originalruid, exactly as passed to thegetresuid(2)system call.euidβ the originaleuid, exactly as passed to thegetresuid(2)system call.suidβ the originalsuid, exactly as passed to thegetresuid(2)system call.
Example: this function is intended to be used in a fashion similar to the following example:
if (getresuid(ruid, euid, suid) < 0)
{
char message[3000];
explain_message_getresuid(message, sizeof(message), ruid, euid, suid);
fprintf(stderr, "%s\n", message);
exit(EXIT_FAILURE);
}
the above code example is available pre-packaged as the explain_getresuid_or_die(3) function. β
π explain_message_errno_getresuid
void explain_message_errno_getresuid(char *message, int message_size, int errnum, uid_t *ruid, uid_t *euid, uid_t *suid);
explain_message_errno_getresuid is used to obtain an explanation of an error returned by the getresuid(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. this one is the full combo: your buffer AND your errno. main character energy, honestly. π
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.ruidβ the originalruid, exactly as passed to thegetresuid(2)system call.euidβ the originaleuid, exactly as passed to thegetresuid(2)system call.suidβ the originalsuid, exactly as passed to thegetresuid(2)system call.
Example: this function is intended to be used in a fashion similar to the following example:
if (getresuid(ruid, euid, suid) < 0)
{
int err = errno;
char message[3000];
explain_message_errno_getresuid(message, sizeof(message), err, ruid, euid, suid);
fprintf(stderr, "%s\n", message);
exit(EXIT_FAILURE);
}
the above code example is available pre-packaged as the explain_getresuid_or_die(3) function. π₯
π SEE ALSO π
getresuid(2)β get real, effective and saved user IDsexplain_getresuid_or_die(3)β get real, effective and saved user IDs and report errors
π COPYRIGHT π
libexplain version 1.4 Copyright (C) 2012 Peter Miller
and that's the whole page, bestie π that was explain_getresuid(3), brought to you by libexplain version 1.4, copyright (C) 2012 Peter Miller. go forth and decode your errnos, you icon. 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