explain_fstatvfs(3)
explain_fstatvfs(3) π
okay bestie, sit down, hydrate, because we're about to make fstatvfs(2) errors make sense. This is the explain_fstatvfs(3) page from the Library Functions Manual, and it's basically the translator your error messages have been begging for. β¨
πΈ NAME πΈ
explain_fstatvfs β no cap, this explains fstatvfs(2) errors for you. π
β¨ SYNOPSIS β¨
#include <libexplain/fstatvfs.h>
const char *explain_fstatvfs(int fildes, struct statvfs *data);
const char *explain_errno_fstatvfs(int errnum, int fildes, struct statvfs *data);
void explain_message_fstatvfs(char *message, int message_size, int fildes, struct statvfs *data);
void explain_message_errno_fstatvfs(char *message, int message_size, int errnum, int fildes, struct statvfs *data);
π¦ DESCRIPTION π¦
These functions are your little group chat with fstatvfs(2) β you ask, they tell you what went wrong. Specifically, you use them to get explanations for errors returned by the fstatvfs(2) system call. π«Ά
π explain_fstatvfs
const char *explain_fstatvfs(int fildes, struct statvfs *data);
The explain_fstatvfs function is how you get an explanation of an error returned by the fstatvfs(2) system call. The absolute least you're getting is the value of strerror(errno), but honestly? It usually does so much better and tells you the underlying cause in way more detail. iconic behaviour fr fr. π
The errno global variable is what gets used to obtain the error value to be decoded.
fildesβ the originalfildes, exactly as passed to thefstatvfs(2)system call. don't be cute with it, pass it as-is.dataβ the originaldata, exactly as passed to thefstatvfs(2)system call.
Returns:
The message explaining the error. Heads up though: this message buffer is shared by all libexplain functions that don't supply a buffer in their argument list. So it gets overwritten by the next call to any libexplain function that shares this buffer β including calls from other threads. π
Note: this function is not thread safe, because it shares a return buffer across all threads, and so do many other functions in this library. lowkey a situationship with that buffer.
Example: this function is intended to be used in a fashion similar to the following example:
if (fstatvfs(fildes, data) < 0)
{
fprintf(stderr, "%s\n", explain_fstatvfs(fildes, data));
exit(EXIT_FAILURE);
}
The above code example is available preβpackaged as the explain_fstatvfs_or_die(3) function. π
π§ explain_errno_fstatvfs
const char *explain_errno_fstatvfs(int errnum, int fildes, struct statvfs *data);
The explain_errno_fstatvfs function is used to obtain an explanation of an error returned by the fstatvfs(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. she ate. π₯
errnumβ the error value to be decoded, usually grabbed from theerrnoglobal variable just before this function is called. This matters if you need to run any code between the system call being explained and this function, because so many libc functions will alter the value oferrno. catch it early or it's gone bestie.fildesβ the originalfildes, exactly as passed to thefstatvfs(2)system call.dataβ the originaldata, exactly as passed to thefstatvfs(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 (fstatvfs(fildes, data) < 0)
{
int err = errno;
fprintf(stderr, "%s\n", explain_errno_fstatvfs(err, fildes,
data));
exit(EXIT_FAILURE);
}
The above code example is available preβpackaged as the explain_fstatvfs_or_die(3) function. π
π explain_message_fstatvfs
void explain_message_fstatvfs(char *message, int message_size, int fildes, struct statvfs *data);
The explain_message_fstatvfs function is used to obtain an explanation of an error returned by the fstatvfs(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. periodt. β¨
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. look at you, doing threading right. πmessage_sizeβ the size in bytes of the location in which to store the returned message.fildesβ the originalfildes, exactly as passed to thefstatvfs(2)system call.dataβ the originaldata, exactly as passed to thefstatvfs(2)system call.
Example: This function is intended to be used in a fashion similar to the following example:
if (fstatvfs(fildes, data) < 0)
{
char message[3000];
explain_message_fstatvfs(message, sizeof(message), fildes,
data);
fprintf(stderr, "%s\n", message);
exit(EXIT_FAILURE);
}
The above code example is available preβpackaged as the explain_fstatvfs_or_die(3) function. πΈ
π explain_message_errno_fstatvfs
void explain_message_errno_fstatvfs(char *message, int message_size, int errnum, int fildes, struct statvfs *data);
The explain_message_errno_fstatvfs function is used to obtain an explanation of an error returned by the fstatvfs(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 way that this function understands you. ππ
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 originalfildes, exactly as passed to thefstatvfs(2)system call.dataβ the originaldata, exactly as passed to thefstatvfs(2)system call.
Example: This function is intended to be used in a fashion similar to the following example:
if (fstatvfs(fildes, data) < 0)
{
int err = errno;
char message[3000];
explain_message_errno_fstatvfs(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_fstatvfs_or_die(3) function. π«Ά
π SEE ALSO π
fstatvfs(2)β get file system statistics β¨explain_fstatvfs_or_die(3)β get file system statistics and report errors π
π COPYRIGHT π
libexplain version 1.4 Copyright (C) 2010 Peter Miller
and that's the whole page bestie β explain_fstatvfs(3), brought to you by libexplain version 1.4, Copyright (C) 2010 Peter Miller. go forth and have the most well-explained fstatvfs(2) errors of your life. mwah. π
π¦ 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