From 6471dccd7d836c3d152fcbb9bb3dcf065e9e3302 Mon Sep 17 00:00:00 2001 From: NoobZang Date: Tue, 25 Nov 2025 22:28:06 +0800 Subject: [PATCH] top: Fix refresh hangs by correctly configuring non-blocking TTY Setting O_NONBLOCK via fcntl is not sufficient for TTYs in non-canonical mode. A subsequent tcsetattr call would override this, as the default VMIN and VTIME settings cause the driver to block. Explicitly set VMIN and VTIME to ensure a true non-blocking read. Fixes #26166. --- Userland/Utilities/top.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Userland/Utilities/top.cpp b/Userland/Utilities/top.cpp index 66c67d6ded6023..d4155f0a39b75b 100644 --- a/Userland/Utilities/top.cpp +++ b/Userland/Utilities/top.cpp @@ -212,6 +212,8 @@ static ErrorOr setup_tty() struct termios raw = g_previous_tty_settings; raw.c_lflag &= ~(ECHO | ICANON); + raw.c_cc[VMIN] = 0; + raw.c_cc[VTIME] = 0; // Disable echo and line buffering TRY(Core::System::tcsetattr(STDOUT_FILENO, TCSAFLUSH, raw));