diff --git a/arch/sim/src/sim/posix/sim_hostuart.c b/arch/sim/src/sim/posix/sim_hostuart.c index d158e9f794c..a98410393ad 100644 --- a/arch/sim/src/sim/posix/sim_hostuart.c +++ b/arch/sim/src/sim/posix/sim_hostuart.c @@ -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 */