explain_getpgid(3)

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

✨ explain_getpgid β€” the libexplain glow-up πŸ’…

okay so bestie, this is explain_getpgid(3) from the Library Functions Manual, and it's literally the function that translates crusty getpgid(2) errors into actual human sentences. no cap, it's giving "your syscall failed and here's why" energy. πŸ¦‹


🌸 NAME 🌸

explain_getpgid β€” explain getpgid(2) errors


πŸŽ€ SYNOPSIS πŸŽ€

#include <libexplain/getpgid.h>
const char *explain_getpgid(pid_t pid);
const char *explain_errno_getpgid(int errnum, pid_t pid);
void explain_message_getpgid(char *message, int message_size, pid_t
pid);
void explain_message_errno_getpgid(char *message, int message_size, int
errnum, pid_t pid);

πŸ’– DESCRIPTION πŸ’–

These functions may be used to obtain explanations for errors returned by the getpgid(2) system call. that's the whole vibe. four little icons, all serving the same lewk. πŸ‘‘

🫢 explain_getpgid

const char *explain_getpgid(pid_t pid);

The explain_getpgid function is used to obtain an explanation of an error returned by the getpgid(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. like, it's not gonna give you the bare minimum, she's giving you the lore. 😭

The errno global variable will be used to obtain the error value to be decoded.

  • pid β€” The original pid, exactly as passed to the getpgid(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. 🚨 bestie do not share this between threads unless you want chaos.

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

pid_t result = getpgid(pid);
if (result < 0)
{
    fprintf(stderr, "%s\n", explain_getpgid(pid));
    exit(EXIT_FAILURE);
}

The above code example is available pre-packaged as the explain_getpgid_or_die(3) function. iconic, she comes ready-made. 🎁

πŸ¦‹ explain_errno_getpgid

const char *explain_errno_getpgid(int errnum, pid_t pid);

The explain_errno_getpgid function is used to obtain an explanation of an error returned by the getpgid(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.

  • errnum β€” The error value to be decoded, usually obtained from the errno global 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 of errno. πŸ“Œ so yes, save it first, she's fragile.
  • pid β€” The original pid, exactly as passed to the getpgid(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:

pid_t result = getpgid(pid);
if (result < 0)
{
    int err = errno;
    fprintf(stderr, "%s\n", explain_errno_getpgid(err, pid));
    exit(EXIT_FAILURE);
}

The above code example is available pre-packaged as the explain_getpgid_or_die(3) function.

🌈 explain_message_getpgid

void explain_message_getpgid(char *message, int message_size, pid_t
pid);

The explain_message_getpgid function is used to obtain an explanation of an error returned by the getpgid(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.

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. πŸ‘‘ finally, the responsible queen.
  • message_size β€” The size in bytes of the location in which to store the returned message.
  • pid β€” The original pid, exactly as passed to the getpgid(2) system call.

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

pid_t result = getpgid(pid);
if (result < 0)
{
    char message[3000];
    explain_message_getpgid(message, sizeof(message), pid);
    fprintf(stderr, "%s\n", message);
    exit(EXIT_FAILURE);
}

The above code example is available pre-packaged as the explain_getpgid_or_die(3) function.

🧚 explain_message_errno_getpgid

void explain_message_errno_getpgid(char *message, int message_size, int
errnum, pid_t pid);

The explain_message_errno_getpgid function is used to obtain an explanation of an error returned by the getpgid(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.

  • 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 the errno global 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 of errno.
  • pid β€” The original pid, exactly as passed to the getpgid(2) system call.

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

pid_t result = getpgid(pid);
if (result < 0)
{
    int err = errno;
    char message[3000];
    explain_message_errno_getpgid(message, sizeof(message), err,
    pid);
    fprintf(stderr, "%s\n", message);
    exit(EXIT_FAILURE);
}

The above code example is available pre-packaged as the explain_getpgid_or_die(3) function.


πŸ‘€ SEE ALSO πŸ‘€


libexplain version 1.4 Copyright (C) 2011 Peter Miller


and that's the whole page bestie, no notes, we ate. πŸ“ if you made it this far you're officially a libexplain girlie. this was explain_getpgid(3) from the Library Functions Manual, brought to you by libexplain version 1.4, copyright Β© 2011 Peter Miller β€” stan an icon, mwah πŸ’‹πŸŒΈπŸ«Ά

πŸ“¦ where this page comes from