explain_tcflow(3)
β¨ explain_tcflow(3) β¨
okay so bestie, welcome to explain_tcflow from the Library Functions Manual β it's the glow-up friend for tcflow(3) errors, and she is so good at her job. let's get into it π
πΈ NAME πΈ
explain_tcflow β explain tcflow(3) errors
like, it takes a cryptic little errno gremlin and turns it into an actual sentence you can read. main character energy fr fr π
π SYNOPSIS π
#include <libexplain/tcflow.h>
const char *explain_tcflow(int fildes, int action);
const char *explain_errno_tcflow(int errnum, int fildes, int action);
void explain_message_tcflow(char *message, int message_size, int fildes,
int action);
void explain_message_errno_tcflow(char *message, int message_size, int
errnum, int fildes, int action);
four functions, one mission: tell you what actually went wrong. π¦
π DESCRIPTION π
These functions may be used to obtain explanations for errors returned by the tcflow(3) system call.
basically: tcflow(3) failed, errno is being mysterious, and you deserve answers. β¨
π explain_tcflow
const char *explain_tcflow(int fildes, int action);
The explain_tcflow function is used to obtain an explanation of an error returned by the tcflow(3) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail.
ngl the bare minimum here is a strerror(errno) translation, but she usually pops off way harder than that and tells you the real underlying cause. π
The errno global variable will be used to obtain the error value to be decoded.
fildesβ The originalfildes, exactly as passed to thetcflow(3)system call.actionβ The originalaction, exactly as passed to thetcflow(3)system call.
Returns:
The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads.
Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. bestie, that buffer is communal property π
Example: This function is intended to be used in a fashion similar to the following example:
if (tcflow(fildes, action) < 0)
{
fprintf(stderr, "%s\n", explain_tcflow(fildes, action));
exit(EXIT_FAILURE);
}
The above code example is available preβpackaged as the explain_tcflow_or_die(3) function.
π§ explain_errno_tcflow
const char *explain_errno_tcflow(int errnum, int fildes, int action);
The explain_errno_tcflow function is used to obtain an explanation of an error returned by the tcflow(3) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail.
errnumβ The error value to be decoded, usually obtained from theerrnoglobal variable just before this function is called. This is necessary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value oferrno. (iykyk β libc will absolutely eat your errno if you let it π« )fildesβ The originalfildes, exactly as passed to thetcflow(3)system call.actionβ The originalaction, exactly as passed to thetcflow(3)system call.
Returns:
The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads.
Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. shared buffer, shared problems π
Example: This function is intended to be used in a fashion similar to the following example:
if (tcflow(fildes, action) < 0)
{
int err = errno;
fprintf(stderr, "%s\n", explain_errno_tcflow(err, fildes,
action));
exit(EXIT_FAILURE);
}
The above code example is available preβpackaged as the explain_tcflow_or_die(3) function.
π¦ explain_message_tcflow
void explain_message_tcflow(char *message, int message_size, int fildes,
int action);
The explain_message_tcflow function is used to obtain an explanation of an error returned by the tcflow(3) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail.
The errno global variable will be used to obtain the error value to be decoded.
messageβ The location in which to store the returned message. If a suitable message return buffer is supplied, this function is thread safe. you brought your own buffer? slay, now you're thread safe πmessage_sizeβ The size in bytes of the location in which to store the returned message.fildesβ The originalfildes, exactly as passed to thetcflow(3)system call.actionβ The originalaction, exactly as passed to thetcflow(3)system call.
Example: This function is intended to be used in a fashion similar to the following example:
if (tcflow(fildes, action) < 0)
{
char message[3000];
explain_message_tcflow(message, sizeof(message), fildes,
action);
fprintf(stderr, "%s\n", message);
exit(EXIT_FAILURE);
}
The above code example is available preβpackaged as the explain_tcflow_or_die(3) function.
π explain_message_errno_tcflow
void explain_message_errno_tcflow(char *message, int message_size, int
errnum, int fildes, int action);
The explain_message_errno_tcflow function is used to obtain an explanation of an error returned by the tcflow(3) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail.
messageβ The location in which to store the returned message. If a suitable message return buffer is supplied, this function is thread safe. πmessage_sizeβ The size in bytes of the location in which to store the returned message.errnumβ The error value to be decoded, usually obtained from theerrnoglobal variable just before this function is called. This is necessary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value oferrno. grab that errno immediately, don't let anyone touch it first πfildesβ The originalfildes, exactly as passed to thetcflow(3)system call.actionβ The originalaction, exactly as passed to thetcflow(3)system call.
Example: This function is intended to be used in a fashion similar to the following example:
if (tcflow(fildes, action) < 0)
{
int err = errno;
char message[3000];
explain_message_errno_tcflow(message, sizeof(message), err,
fildes, action);
fprintf(stderr, "%s\n", message);
exit(EXIT_FAILURE);
}
The above code example is available preβpackaged as the explain_tcflow_or_die(3) function.
β SEE ALSO β
tcflow(3)β terminal flow controlexplain_tcflow_or_die(3)β terminal flow control and report errors
π COPYRIGHT π
libexplain version 1.4 Copyright (C) 2009 Peter Miller
and that's the whole page bestie, no cap, every flag and function accounted for π ok so one last cute lil sign-off: this page is explain_tcflow(3), hanging out at the bottom of the Library Functions Manual, brought to you by libexplain version 1.4 with Copyright (C) 2009 Peter Miller β obsessed, iconic, periodt. πβ¨π¦
π¦ 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 Peter Miller
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms