explain_fstatfs(3)
π explain_fstatfs β bestie edition π
okay so this is explain_fstatfs(3), a libexplain page, and it lives in the Library Functions Manual. it's all about turning those cursed fstatfs(2) errors into actual human sentences. no more staring at a bare errno like ποΈπποΈ
β¨ NAME β¨
explain_fstatfs β bestie, let me explain your fstatfs(2) errors π
π SYNOPSIS π
#include <libexplain/fstatfs.h>
const char *explain_fstatfs(int fildes, struct statfs *data);
const char *explain_errno_fstatfs(int errnum, int fildes, struct statfs *data);
void explain_message_fstatfs(char *message, int message_size, int fildes, struct statfs *data);
void explain_message_errno_fstatfs(char *message, int message_size, int errnum, int fildes, struct statfs *data);
πΈ DESCRIPTION πΈ
so these functions are literally here to hand you explanations for errors that the fstatfs(2) system call throws back at you. it's giving translator, it's giving "what did the kernel MEAN by that". π§
explain_fstatfs
const char *explain_fstatfs(int fildes, struct statfs *data);
the explain_fstatfs function gets you an explanation of an error returned by the fstatfs(2) system call. the least the message will contain is the value of strerror(errno), but usually it goes way harder than that and tells you the underlying cause in more detail. like, it actually spills the tea. π₯
the errno global variable is what gets used to obtain the error value to be decoded.
fildesβ the original fildes, exactly as passed to thefstatfs(2)system call. no notes, verbatim.dataβ the original data, exactly as passed to thefstatfs(2)system call.
Returns:
- the message explaining the error. this message buffer is shared by all libexplain functions that don't supply a buffer in their argument list. it will be overwritten by the next call to any libexplain function that shares this buffer, including other threads. so like... screenshot it or copy it, don't just vibe with 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 do too.
Example: this function is intended to be used in a fashion similar to the following example:
if (fstatfs(fildes, data) < 0)
{
fprintf(stderr, "%s\n", explain_fstatfs(fildes, data));
exit(EXIT_FAILURE);
}
the above code example is available preβpackaged as the explain_fstatfs_or_die(3) function. convenient much? π
explain_errno_fstatfs
const char *explain_errno_fstatfs(int errnum, int fildes, struct statfs *data);
the explain_errno_fstatfs function gets you an explanation of an error returned by the fstatfs(2) system call. same deal: the least the message will contain is the value of strerror(errno), but usually it does much better and points at the underlying cause in more detail. β¨
errnumβ the error value to be decoded, usually obtained from theerrnoglobal variable just before this function is called. this one 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 bestie, it's that fragile. πfildesβ the original fildes, exactly as passed to thefstatfs(2)system call.dataβ the original data, exactly as passed to thefstatfs(2)system call.
Returns:
- the message explaining the error. this message buffer is shared by all libexplain functions that don't supply a buffer in their argument list. it will be overwritten by the next call to any libexplain function that 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 do too.
Example: this function is intended to be used in a fashion similar to the following example:
if (fstatfs(fildes, data) < 0)
{
int err = errno;
fprintf(stderr, "%s\n", explain_errno_fstatfs(err, fildes, data));
exit(EXIT_FAILURE);
}
the above code example is available preβpackaged as the explain_fstatfs_or_die(3) function. π
explain_message_fstatfs
void explain_message_fstatfs(char *message, int message_size, int fildes, struct statfs *data);
the explain_message_fstatfs function gets you an explanation of an error returned by the fstatfs(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 is what gets 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. look at her, being all responsible. π«Άmessage_sizeβ the size in bytes of the location in which to store the returned message.fildesβ the original fildes, exactly as passed to thefstatfs(2)system call.dataβ the original data, exactly as passed to thefstatfs(2)system call.
Example: this function is intended to be used in a fashion similar to the following example:
if (fstatfs(fildes, data) < 0)
{
char message[3000];
explain_message_fstatfs(message, sizeof(message), fildes, data);
fprintf(stderr, "%s\n", message);
exit(EXIT_FAILURE);
}
the above code example is available preβpackaged as the explain_fstatfs_or_die(3) function. π
explain_message_errno_fstatfs
void explain_message_errno_fstatfs(char *message, int message_size, int errnum, int fildes, struct statfs *data);
the explain_message_errno_fstatfs function gets you an explanation of an error returned by the fstatfs(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 ate, 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.fildesβ the original fildes, exactly as passed to thefstatfs(2)system call.dataβ the original data, exactly as passed to thefstatfs(2)system call.
Example: this function is intended to be used in a fashion similar to the following example:
if (fstatfs(fildes, data) < 0)
{
int err = errno;
char message[3000];
explain_message_errno_fstatfs(message, sizeof(message), err, fildes, data);
fprintf(stderr, "%s\n", message);
exit(EXIT_FAILURE);
}
the above code example is available preβpackaged as the explain_fstatfs_or_die(3) function. π
π¦ SEE ALSO π¦
fstatfs(2)β get file system statisticsexplain_fstatfs_or_die(3)β get file system statistics and report errors
π COPYRIGHT π
libexplain version 1.4
Copyright (C) 2009 Peter Miller
okay that's the whole page bestie, you're officially fluent in explain_fstatfs(3) now π
β¨
this little scroll of knowledge comes to you from libexplain version 1.4, copyright (C) 2009 Peter Miller β and yes that footer is giving main character energy, as it should π
π¦ 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