explain_fpurge(3)
β¨ 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 thefpurge(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 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 grab it early, bestie, or it's gone πfpβ the original fp, exactly as passed to thefpurge(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 thefpurge(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 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. capture it immediately or it's over πfpβ the original fp, exactly as passed to thefpurge(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 π
fpurge(3)β purge a stream πΏexplain_fpurge_or_die(3)β purge a stream and report errors π
π COPYRIGHT π
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
- 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) 2010, 2011 Peter Miller
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms