explain_fpurge(3)

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

✨ NAME ✨

explain_fpurge β€” the girl whose entire job is explaining fpurge(3) errors to you, bestie πŸ’…


🌸 SYNOPSIS 🌸

#include <libexplain/fpurge.h>
const char *explain_fpurge(FILE *fp);
const char *explain_errno_fpurge(int errnum, FILE *fp);
void explain_message_fpurge(char *message, int message_size, FILE *fp);
void explain_message_errno_fpurge(char *message, int message_size, int errnum, FILE *fp);

πŸ’– DESCRIPTION πŸ’–

okay so these functions may be used to obtain explanations for errors returned by the fpurge(3) system call. that's it, that's the vibe. four little besties, all here to tell you what went wrong 🫢


πŸ¦‹ explain_fpurge πŸ¦‹

const char *explain_fpurge(FILE *fp);

The explain_fpurge function is used to obtain an explanation of an error returned by the fpurge(3) system call. and ngl, 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 giving overachiever ✨

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

  • fp β€” the original fp, exactly as passed to the fpurge(3) system call. no edits, no remixes, exactly as-is πŸ’…

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. it will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. so like… screenshot it or copy it, don't just hold onto the pointer 😭

Note: this function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. no cap.

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

if (fpurge(fp) < 0)
{
    fprintf(stderr, "%s\n", explain_fpurge(fp));
    exit(EXIT_FAILURE);
}

the above code example is available pre-packaged as the explain_fpurge_or_die(3) function. iconic behavior, honestly πŸ‘‘


🌈 explain_errno_fpurge 🌈

const char *explain_errno_fpurge(int errnum, FILE *fp);

The explain_errno_fpurge function is used to obtain an explanation of an error returned by the fpurge(3) 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. she ate fr fr

  • 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 grab it early, bestie, or it's gone πŸ™ˆ
  • fp β€” the original fp, exactly as passed to the fpurge(3) 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. the way that buffer is shared… 😭

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 (fpurge(fp) < 0)
{
    int err = errno;
    fprintf(stderr, "%s\n", explain_errno_fpurge(err, fp));
    exit(EXIT_FAILURE);
}

the above code example is available pre-packaged as the explain_fpurge_or_die(3) function. periodt πŸ’…


πŸŽ€ explain_message_fpurge πŸŽ€

void explain_message_fpurge(char *message, int message_size, FILE *fp);

The explain_message_fpurge function is used to obtain an explanation of an error returned by the fpurge(3) 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. lowkey the most useful one of the four 🫢

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. you brought your own buffer? slay ✨
  • message_size β€” the size in bytes of the location in which to store the returned message.
  • fp β€” the original fp, exactly as passed to the fpurge(3) system call.

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

if (fpurge(fp) < 0)
{
    char message[3000];
    explain_message_fpurge(message, sizeof(message), fp);
    fprintf(stderr, "%s\n", message);
    exit(EXIT_FAILURE);
}

the above code example is available pre-packaged as the explain_fpurge_or_die(3) function. she's got her own char message[3000], main character energy πŸ’–


⭐ explain_message_errno_fpurge ⭐

void explain_message_errno_fpurge(char *message, int message_size, int errnum, FILE *fp);

The explain_message_errno_fpurge function is used to obtain an explanation of an error returned by the fpurge(3) 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 full combo, the deluxe edition, the bestie supreme πŸ“

  • 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. capture it immediately or it's over 😭
  • fp β€” the original fp, exactly as passed to the fpurge(3) system call.

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

if (fpurge(fp) < 0)
{
    int err = errno;
    char message[3000];
    explain_message_errno_fpurge(message, sizeof(message), err,
    fp);
    fprintf(stderr, "%s\n", message);
    exit(EXIT_FAILURE);
}

the above code example is available pre-packaged as the explain_fpurge_or_die(3) function. obsessed πŸ‘‘


πŸ’œ SEE ALSO πŸ’œ


libexplain version 1.4 Copyright (C) 2010 Peter Miller


and that's the whole page bestie πŸ’– she lives in the Library Functions Manual, section 3, explain_fpurge(3), and she is brought to you by libexplain version 1.4, with the copyright held down by Peter Miller back in 2010 🌸 go forth and explain those fpurge(3) errors, you've got this 🧚

πŸ“¦ where this page comes from