explain_statfs(3)
π explain_statfs β okay bestie, let's decode some errors π
hey hi hello, welcome to explain_statfs(3) from the Library Functions Manual π this is the page where libexplain teaches you how to turn a cryptic statfs(2) failure into an actual, readable, human explanation. no cap. it's giving β¨clarityβ¨
πΈ NAME πΈ
explain_statfs β bestie, it explains statfs(2) errors. that's the whole vibe. π
β¨ SYNOPSIS β¨
#include <libexplain/statfs.h>
const char *explain_statfs(const char *pathname, struct statfs *data);
const char *explain_errno_statfs(int errnum, const char *pathname,
struct statfs *data);
void explain_message_statfs(char *message, int message_size, const char
*pathname, struct statfs *data);
void explain_message_errno_statfs(char *message, int message_size, int
errnum, const char *pathname, struct statfs *data);
look at those four icons π four functions, four ways to get the tea on what went wrong.
π¦ DESCRIPTION π¦
these functions are your little helpers for getting explanations of errors that the statfs(2) system call throws back at you. like, it failed, but why? these will tell you. π«Ά
π explain_statfs
const char *explain_statfs(const char *pathname, struct statfs *data);
so explain_statfs gets you an explanation of an error returned by the statfs(2) system call. the absolute least the message will contain is the value of strerror(errno), but ngl it usually does so much better than that and points at the underlying cause in way more detail. main character behavior, honestly.
the errno global variable is what gets used to obtain the error value to be decoded. periodt.
pathnameβ the original pathname, exactly as passed to thestatfs(2)system call. don't be out here editing it, bestie.dataβ the original data, exactly as passed to thestatfs(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. it will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. so don't be clingy with that pointer, it's not yours forever. π
Note: this function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library do too. iykyk. π
Example: this function is intended to be used in a fashion similar to the following example:
if (statfs(pathname, data) < 0)
{
fprintf(stderr, "%s\n", explain_statfs(pathname, data));
exit(EXIT_FAILURE);
}
and the above code example is available preβpackaged as the explain_statfs_or_die(3) function. so if you're feeling lazy (valid), that's your girl. π
πΈ explain_errno_statfs
const char *explain_errno_statfs(int errnum, const char *pathname,
struct statfs *data);
explain_errno_statfs gets you an explanation of an error returned by the statfs(2) system call. the least the message will contain is the value of strerror(errno), but usually it does much better and indicates the underlying cause in more detail. she's thorough. π
errnumβ the error value to be decoded, usually grabbed 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 like, save it first, okay?? πpathnameβ the original pathname, exactly as passed to thestatfs(2)system call.dataβ the original data, exactly as passed to thestatfs(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 (statfs(pathname, data) < 0)
{
int err = errno;
fprintf(stderr, "%s\n", explain_errno_statfs(err, pathname,
data));
exit(EXIT_FAILURE);
}
the above code example is available preβpackaged as the explain_statfs_or_die(3) function. π
π§ explain_message_statfs
void explain_message_statfs(char *message, int message_size, const char
*pathname, struct statfs *data);
explain_message_statfs gets you an explanation of an error returned by the statfs(2) system call. the least the message will contain is the value of strerror(errno), but usually it does much better and indicates the underlying cause in more detail. she ate. π₯
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. ooh look at her, responsible. β¨message_sizeβ the size in bytes of the location in which to store the returned message.pathnameβ the original pathname, exactly as passed to thestatfs(2)system call.dataβ the original data, exactly as passed to thestatfs(2)system call.
Example: this function is intended to be used in a fashion similar to the following example:
if (statfs(pathname, data) < 0)
{
char message[3000];
explain_message_statfs(message, sizeof(message), pathname,
data);
fprintf(stderr, "%s\n", message);
exit(EXIT_FAILURE);
}
the above code example is available preβpackaged as the explain_statfs_or_die(3) function. π¦
π explain_message_errno_statfs
void explain_message_errno_statfs(char *message, int message_size, int
errnum, const char *pathname, struct statfs *data);
explain_message_errno_statfs gets you an explanation of an error returned by the statfs(2) system call. the least the message will contain is the value of strerror(errno), but usually it does much better and indicates the underlying cause in more detail. the full combo meal, bestie. π
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. (yes we're saying it again, it matters!! π€)pathnameβ the original pathname, exactly as passed to thestatfs(2)system call.dataβ the original data, exactly as passed to thestatfs(2)system call.
Example: this function is intended to be used in a fashion similar to the following example:
if (statfs(pathname, data) < 0)
{
int err = errno;
char message[3000];
explain_message_errno_statfs(message, sizeof(message), err,
pathname, data);
fprintf(stderr, "%s\n", message);
exit(EXIT_FAILURE);
}
the above code example is available preβpackaged as the explain_statfs_or_die(3) function. π
π SEE ALSO π
statfs(2)β get file system statisticsexplain_statfs_or_die(3)β get file system statistics and report errors
π COPYRIGHT π
libexplain version 1.4 Copyright (C) 2009 Peter Miller
and that's the whole page, bestie!! π«Ά go forth and never be confused by a statfs(2) error again β you're literally so good at this now. slay β¨πΈπ
π¦ 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