explain_dup_or_die(3)
π explain_dup_or_die(3) π
okay bestie, welcome to the Library Functions Manual, and today's main character is explain_dup_or_die β she duplicates a file descriptor AND tells you what went wrong when it goes wrong. no cap. π¦
β¨ NAME β¨
explain_dup_or_die β duplicate a file descriptor and report errors π
πΈ SYNOPSIS πΈ
#include <libexplain/dup.h>
void explain_dup_or_die(int fildes);
like, that's the whole vibe. two lines. iconic.
π DESCRIPTION π
so the explain_dup_or_die function is literally just here to call the dup(2) system call for you. that's the job. that's the assignment. π
and if it fails?? bestie, it prints an explanation to stderr β and that explanation comes straight from explain_dup(3), so you're getting the good stuff, not some cryptic nonsense β and then the process terminates by calling exit(EXIT_FAILURE). yeah, she does not do second chances. it's giving "die" in the name for a reason π
this function is intended to be used in a fashion similar to the following example:
explain_dup_or_die(fildes);
and here's the deets on that argument, no gatekeeping:
fildesβ Thefildes, exactly as to be passed to thedup(2)system call. like, don't get cute with it, pass it exactly. β¨
Returns:
this function only returns on success. on failure, it prints an explanation and exits. periodt. π
π SEE ALSO π
dup(2)β duplicate a file descriptorexplain_dup(3)β explaindup(2)errorsexit(2)β terminate the calling process
go read those, iykyk π«Ά
π COPYRIGHT π
libexplain version 1.4
Copyright (C) 2008 Peter Miller
okay that's the whole page, bestie!! π thanks for reading all the way to the bottom, you're a real one. this was explain_dup_or_die(3) from the Library Functions Manual, brought to you by libexplain version 1.4, Copyright (C) 2008 Peter Miller β mwah, slay, go duplicate some file descriptors responsibly. πΈπ
β¨
π¦ 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) 2008, 2009, 2011 Peter Miller
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms