arch/sim: switch nonblock setup to ioctl FIONBIO

Update host_uart_start() to set stdin/stdout nonblocking via ioctl.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2026-09-01 19:47:13 +08:00 committed by Alan C. Assis
parent ae666954e6
commit 83b4239e1d

View file

@ -95,7 +95,7 @@ static void restoremode(void)
void host_uart_start(void)
{
int flags;
int nonblock = 1;
/* Get the current stdin terminal mode */
@ -105,21 +105,13 @@ void host_uart_start(void)
setrawmode(0);
flags = host_uninterruptible(fcntl, 0, F_GETFL, 0);
if (flags > 0)
{
host_uninterruptible_no_return(fcntl, 0, F_SETFL, flags | O_NONBLOCK);
}
host_uninterruptible_no_return(ioctl, 0, FIONBIO, &nonblock);
/* Set stdout to non-blocking to prevent write(1, ...) from blocking
* the entire sim process when the host pipe buffer is full.
*/
flags = host_uninterruptible(fcntl, 1, F_GETFL, 0);
if (flags > 0)
{
host_uninterruptible_no_return(fcntl, 1, F_SETFL, flags | O_NONBLOCK);
}
host_uninterruptible_no_return(ioctl, 1, FIONBIO, &nonblock);
/* Restore the original terminal mode before exit */