explain_fstatfs_or_die(3)

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

✨ explain_fstatfs_or_die(3) ✨

okay so bestie, buckle up, this is a page from the Library Functions Manual and it's literally all about grabbing file system stats and then being super dramatic when things go wrong. πŸŽ€


πŸ’– NAME πŸ’–

explain_fstatfs_or_die β€” get file system statistics and report errors πŸ¦‹


🌸 SYNOPSIS 🌸

#include <libexplain/fstatfs.h>
void explain_fstatfs_or_die(int fildes, struct statfs *data);
int explain_fstatfs_on_error(int fildes, struct statfs *data);

πŸ‘‘ DESCRIPTION πŸ‘‘

so there's these two functions and they're basically the same vibe, except one of them is a main character who cannot handle failure and the other one is chill about it. πŸ’…

The explain_fstatfs_or_die function is used to call the fstatfs(2) system call. On failure an explanation will be printed to stderr, obtained from the explain_fstatfs(3) function, and then the process terminates by calling exit(EXIT_FAILURE). 😭 like, it does not come back. it's giving "we die like men". periodt.

The explain_fstatfs_on_error function is used to call the fstatfs(2) system call. On failure an explanation will be printed to stderr, obtained from the explain_fstatfs(3) function, but still returns to the caller. so it tells you what went wrong and then just... hands you back the L and lets you keep going. iconic behavior honestly. 🫢

  • fildes β€” The fildes, exactly as to be passed to the fstatfs(2) system call. no notes, no changes, hand it over exactly like that fr fr.
  • data β€” The data, exactly as to be passed to the fstatfs(2) system call. same deal, verbatim, don't be weird about it. ✨

🌈 RETURN VALUE 🌈

The explain_fstatfs_or_die function only returns on success, see fstatfs(2) for more information. On failure, prints an explanation and exits, it does not return. like at all. never. πŸ’€

The explain_fstatfs_on_error function always returns the value return by the wrapped fstatfs(2) system call. so you always get something back, bestie. πŸ“


🧚 EXAMPLE 🧚

The explain_fstatfs_or_die function is intended to be used in a fashion similar to the following example:

explain_fstatfs_or_die(fildes, data);

that's it. that's the whole vibe. lowkey gorgeous. 🌸


⭐ SEE ALSO ⭐


libexplain version 1.4 Copyright (C) 2009 Peter Miller


okay that's the whole page bestie, go forth and get those file system statistics responsibly πŸ¦‹βœ¨ and yeah β€” this was explain_fstatfs_or_die(3) from the Library Functions Manual, running libexplain version 1.4, with the copyright sitting pretty at Copyright (C) 2009 Peter Miller. love that for us. no cap. πŸ’–πŸ‘‘

πŸ“¦ where this page comes from