TCFLUSH(3P)
π TCFLUSH(3P) β bestie's guide to flushing terminal queues
okay so this one is from the POSIX Programmer's Manual, section 3P, and the name is literally tcflush. welcome to the group chat π
β¨ PROLOG
so like, real talk first: this manual page is part of the POSIX Programmer's Manual. the Linux implementation of this interface may differ (so go check the corresponding Linux manual page for the actual Linux tea β), or honestly the interface may not be implemented on Linux at all. not me warning you before we even start π
πΈ 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 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) but not transmitted, or data received but not read β and which one it does 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 β¨
and now the dramatic 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. but β if the calling thread is blocking SIGTTOU signals, or the process is ignoring SIGTTOU signals, the process shall be allowed to perform the operation, and no signal is sent. slay, no cap π
π 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 vibe.
π₯ ERRORS
the tcflush() function shall fail if:
EBADFβ thefildesargument is not a valid file descriptor. fake fd, we don't know her πEINVALβ thequeue_selectorargument is not a supported value. not a real selector bestie πEIOβ the process group of the writing process is orphaned, the calling thread is not blockingSIGTTOU, and the process is not ignoringSIGTTOU. the way that's three whole conditions πENOTTYβ the file associated withfildesis not a terminal. sorry, this is giving "not a tty" energy π«
the following sections are informative (iykyk, that means they're β¨vibes onlyβ¨, not actual requirements):
π EXAMPLES
None. nothing. zero. nada. the void π³οΈ
π APPLICATION USAGE
None. again, nothing. iconic of them honestly.
β RATIONALE
None. truly no thoughts, head empty π§ β¨
πΈ FUTURE DIRECTIONS
None. the future is... also nothing. periodt.
π§ 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. 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 (so like, if they fight, the original wins π₯). 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 .
so yeah, that's the whole page. no notes, only facts, and every single one of them stayed π
kisses, and this page was brought to you by IEEE/The Open Group, 2017 β mwah πβ¨
π¦ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 Β· custom
- alpine 3.23: man-pages-posix 2017a-r0 Β· custom
- alpine 3.24: man-pages-posix 2017a-r0 Β· custom
- arch rolling: man-pages 6.19-1
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 Β· SUSE-IEEE
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms