explain_pipe2_or_die(3)

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

πŸ’– explain_pipe2_or_die πŸ’–

okay bestie, you found the <libexplain/pipe2.h> page, aka the Library Functions Manual entry for explain_pipe2_or_die β€” and yes she's a whole vibe. let's get into it 🫢


✨ NAME ✨

explain_pipe2_or_die β€” create pipe and report errors


🌸 SYNOPSIS 🌸

#include <libexplain/pipe2.h>
void explain_pipe2_or_die(int *fildes, int flags);
int explain_pipe2_on_error(int *fildes, int flags);

πŸ’… DESCRIPTION πŸ’…

so like, there are two functions here and they're sisters, not twins, okay?

  • explain_pipe2_or_die β€” she's the dramatic one. she calls the pipe2(2) system call, and if things go sideways, an explanation gets printed to stderr (obtained from the explain_pipe2(3) function), and then the process terminates by calling exit(EXIT_FAILURE). no survivors. periodt. πŸ’€
  • explain_pipe2_on_error β€” she's the chill one. she also calls the pipe2(2) system call, and on failure an explanation is still printed to stderr, obtained from the explain_pipe2(3) function β€” but she still returns to the caller. she just tells you what happened and keeps it moving. πŸ¦‹

now the arguments, because details matter:

  • fildes β€” the fildes, exactly as to be passed to the pipe2(2) system call. no notes, no edits, pass it through as-is. ✨
  • flags β€” the flags, exactly as to be passed to the pipe2(2) system call. same energy. πŸ’–

⭐ RETURN VALUE ⭐

explain_pipe2_or_die only returns on success β€” see pipe2(2) for more information. on failure she prints an explanation and exits, so like... she does not return. at all. she's gone. πŸ‘‘

explain_pipe2_on_error always returns the value returned by the wrapped pipe2(2) system call. every single time. reliable queen. πŸŽ€


🌈 EXAMPLE 🌈

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

explain_pipe2_or_die(fildes, flags);

that's it. that's the whole thing. iconic, honestly. πŸ’œ


🧚 SEE ALSO 🧚


libexplain version 1.4 Copyright (C) 2013 Peter Miller

and that's the page bestie!! 🌸 libexplain version 1.4, copyright 2013 Peter Miller β€” go forth and pipe responsibly, mwah πŸ’‹πŸ’…βœ¨

πŸ“¦ where this page comes from