TCFLUSH(3POSIX)
π PROLOG π
okay so before we even get into it: this page is part of the POSIX Programmer's Manual, bestie. that's the whole vibe. and a heads-up fr fr β the Linux implementation of this interface may differ, so go check the corresponding Linux manual page for the deets on Linux behavior. or honestly? the interface might not even be implemented on Linux. π just so you know.
β¨ NAME β¨
tcflush β flush non-transmitted output data, non-read input data, or both π
π SYNOPSIS π
#include <termios.h>
int tcflush(int fildes, int queue_selector);
π¦ DESCRIPTION π¦
so like, upon successful completion, tcflush() shall discard data written to the object referred to by fildes (that's an open file descriptor associated with a terminal, iykyk) but not transmitted, or data received but not read β it depends on the value of queue_selector:
- if
queue_selectorisTCIFLUSH, it shall flush data received but not read. π₯ - if
queue_selectorisTCOFLUSH, it shall flush data written but not transmitted. π€ - if
queue_selectorisTCIOFLUSH, it shall flush both data received but not read and data written but not transmitted. π
now the spicy part πΆοΈ β attempts to use tcflush() from a process which is a member of a background process group on a fildes associated with its controlling terminal shall cause the process group to be sent a SIGTTOU signal. that's giving main character energy but in a "you got caught" way π.
but β if the calling thread is blocking SIGTTOU signals, or the process is ignoring SIGTTOU signals, then the process shall be allowed to perform the operation, and no signal is sent. slay, loophole. π
π₯ RETURN VALUE π₯
upon successful completion, 0 shall be returned. otherwise, -1 shall be returned and errno set to indicate the error. that's it, that's the deal. β
π ERRORS π
the tcflush() function shall fail if:
EBADFβ thefildesargument is not a valid file descriptor. π»EINVALβ thequeue_selectorargument is not a supported value. π«EIOβ the process group of the writing process is orphaned, the calling thread is not blockingSIGTTOU, and the process is not ignoringSIGTTOU. πENOTTYβ the file associated withfildesis not a terminal. π
also: the following sections are informative. not binding, just vibes. π
π EXAMPLES π
None.
π§ APPLICATION USAGE π§
None.
π RATIONALE π
None.
πΈ FUTURE DIRECTIONS πΈ
None.
π SEE ALSO π
tcdrain()- The Base Definitions volume of POSIX.1β2017, Chapter 11, General Terminal Interface,
<termios.h>
π COPYRIGHT π
portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. π
and listen β in the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. no cap, that's the authority. the original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. π to report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
and that's the whole page, bestie π«Ά β brought to you by IEEE/The Open Group, 2017, under the name TCFLUSH(3POSIX) in the POSIX Programmer's Manual. periodt. β¨
π¦ where this page comes from
- debian bookworm: manpages-posix-dev 2017a-2 Β· Other
- debian trixie: manpages-posix-dev 2017a-2 Β· Other
- ubuntu jammy: manpages-posix-dev 2017a-2 Β· Other
- ubuntu noble: manpages-posix-dev 2017a-2 Β· Other
- ubuntu resolute: manpages-posix-dev 2017a-2build1 Β· Other
- ubuntu stonking: manpages-posix-dev 2017a-2.1 Β· Other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms