explain_tcdrain_or_die(3)
π 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β thefildes, exactly as to be passed to thetcdrain(3)system call. like, don't get creative with it, hand it over the exact waytcdrain(3)wants it. π
β RETURN VALUE β
explain_tcdrain_or_dieonly returns on success, and if you want the details on that, seetcdrain(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_erroralways returns the value return by the wrappedtcdrain(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 π₯
tcdrain(3)β Executetcdrain(3)explain_tcdrain(3)β explaintcdrain(3)errorsexit(2)β terminate the calling process
π COPYRIGHT π
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
- 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) 2009, 2011, 2013 Peter Miller
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms