explain_sleep_or_die(3)

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

πŸ’€ explain_sleep_or_die(3) β€” Library Functions Manual πŸ’€

okay bestie, pull up a chair, we're talking about explain_sleep_or_die from the libexplain girlies. this is a manual page, she's iconic, she's three pages long, let's go ✨


🌸 NAME 🌸

explain_sleep_or_die β€” sleep for a number of seconds and report errors πŸ’€πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <libexplain/sleep.h>
unsigned int explain_sleep_or_die(unsigned int seconds);
unsigned int explain_sleep_on_error(unsigned int seconds);

like literally copy-paste that, no cap 🫢


✨ DESCRIPTION ✨

okay so. the explain_sleep_or_die function is used to call the sleep(3) system call. if it fails, an explanation gets printed to stderr, obtained from the explain_sleep(3) function, and then the process terminates by calling exit(EXIT_FAILURE).

πŸ’€ yes bestie, "or die" is not a cute nickname, she means it. process over. gone. no cap.

the explain_sleep_on_error function is also used to call the sleep(3) system call. on failure an explanation gets printed to stderr, obtained from the explain_sleep(3) function, but this one still returns to the caller. so she's the chill one 🧚

  • seconds β€” the seconds, exactly as to be passed to the sleep(3) system call. don't get creative, just pass it through πŸ’–

πŸ‘‘ RETURN VALUE πŸ‘‘

the explain_sleep_or_die function only returns on success, see sleep(3) for more information. on failure, prints an explanation and exits, it does not return.

😭 like literally does not return. the return type is a whole lie on the failure path. that's the vibe.

the explain_sleep_on_error function always returns the value returned by the wrapped sleep(3) system call. she's consistent, we love her 🌈


πŸ¦‹ EXAMPLE πŸ¦‹

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

unsigned int result = explain_sleep_or_die(seconds);

one line. one call. maximum chaos potential. slay πŸ”₯


⭐ SEE ALSO ⭐

iykyk, the whole little family πŸ’œ


libexplain version 1.4 Copyright (C) 2013 Peter Miller


and that's the whole page bestie, tysm for reading, this was explain_sleep_or_die(3) from the Library Functions Manual β€” shoutout to libexplain version 1.4 and Copyright (C) 2013 Peter Miller for making her exist πŸŽ€πŸ’…βœ¨ ily, go take a nap (responsibly, with error handling) πŸ’€πŸ«Ά

πŸ“¦ where this page comes from