explain_ustat_or_die(3)

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

✨ NAME ✨

explain_ustat_or_die β€” get file system statistics and report errors πŸ’–

okay so bestie, this is a page from the Library Functions Manual, and it's literally all about explain_ustat_or_die (and its chill sibling explain_ustat_on_error). iykyk πŸ¦‹


🌸 SYNOPSIS 🌸

#include <libexplain/ustat.h>
void explain_ustat_or_die(dev_t dev, struct ustat *ubuf);
int explain_ustat_on_error(dev_t dev, struct ustat *ubuf);

πŸ’… DESCRIPTION πŸ’…

so the explain_ustat_or_die function is what you call when you wanna call the ustat(2) system call. and if it fails? 😭 an explanation gets printed to stderr, grabbed straight from the explain_ustat(3) function, and then the process terminates by calling exit(EXIT_FAILURE). like, it's done. it does not come back. periodt πŸ’€

meanwhile explain_ustat_on_error also calls the ustat(2) system call, and on failure it also prints an explanation to stderr from explain_ustat(3) β€” but it still returns to the caller. so much more chill of it honestly 🫢

  • dev β€” the dev, exactly as to be passed to the ustat(2) system call. no edits, no vibes-based tweaking, just hand it over as-is bestie ✨
  • ubuf β€” the ubuf, exactly as to be passed to the ustat(2) system call. same energy, same rule πŸ‘‘

πŸ‘‘ RETURN VALUE πŸ‘‘

the explain_ustat_or_die function only returns on success β€” see ustat(2) for more info. on failure it prints an explanation and exits, so like… it does not return. at all. ever. not me waiting for a return value that's never coming πŸ™ˆ

the explain_ustat_on_error function always returns the value return by the wrapped ustat(2) system call. yes bestie, that's what it says, character for character πŸ’œ


⭐ EXAMPLE ⭐

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

explain_ustat_or_die(dev, ubuf);

look at that. clean. iconic. no notes πŸ’…


πŸŽ€ SEE ALSO πŸŽ€


libexplain version 1.4 Copyright (C) 2009 Peter Miller


and that's the whole page bestie, tysm for reading πŸ₯° this was explain_ustat_or_die(3) from the Library Functions Manual, brought to you by libexplain version 1.4, Copyright (C) 2009 Peter Miller β€” slay, mwah πŸ’‹πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from