explain_tcdrain_or_die(3)

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

πŸ’– NAME πŸ’–

okay bestie, come sit, we're reading explain_tcdrain_or_die(3) together β€” it's from the Library Functions Manual and honestly it's giving "small function, huge personality". πŸ’…

explain_tcdrain_or_die β€” Execute tcdrain(3) and report errors. that's the whole name, no cap. ✨


πŸŽ€ SYNOPSIS πŸŽ€

#include <libexplain/tcdrain.h>
void explain_tcdrain_or_die(int fildes);
int explain_tcdrain_on_error(int fildes);

two functions, one header, zero chaos (until something fails, and then all the chaos). 🌸


πŸ¦‹ DESCRIPTION πŸ¦‹

so the explain_tcdrain_or_die function is literally just here to call the tcdrain(3) system call for you. that's her whole job. main character energy fr fr.

and when it fails? 😭 an explanation gets printed to stderr β€” she gets it from the explain_tcdrain(3) function β€” and then the process terminates by calling exit(EXIT_FAILURE). so like... she is not coming back. periodt. πŸ’€

the explain_tcdrain_on_error function is the same situation, she calls the tcdrain(3) system call too, and on failure an explanation is printed to stderr, also obtained from the explain_tcdrain(3) function β€” but this one still returns to the caller. no exiting, no theatrics, she just comes home. 🫢

here's the one and only argument, bestie:

  • fildes β€” the fildes, exactly as to be passed to the tcdrain(3) system call. like, don't get creative with it, hand it over the exact way tcdrain(3) wants it. πŸ’œ

⭐ RETURN VALUE ⭐

  • explain_tcdrain_or_die only returns on success, and if you want the details on that, see tcdrain(3) for more information. on failure she prints an explanation and exits, so she does not return. she's gone, she's left the group chat. πŸ™ˆ
  • explain_tcdrain_on_error always returns the value return by the wrapped tcdrain(3) system call. every single time. iconic behavior. πŸ‘‘

🌈 EXAMPLE 🌈

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

explain_tcdrain_or_die(fildes);

that's it. that's the example. short, sweet, slay. πŸ’…


πŸ”₯ SEE ALSO πŸ”₯


libexplain version 1.4

Copyright (C) 2009 Peter Miller,,,


okay that's the whole page bestie, we ate and left no crumbs πŸ“ this was explain_tcdrain_or_die(3), brought to you by libexplain version 1.4 with Copyright (C) 2009 Peter Miller,,, β€” mwah πŸ’‹ stay hydrated, read your man pages, and may every single one of your tcdrain(3) calls return on success. bye!! πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ§šπŸ’œ

πŸ“¦ where this page comes from