This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 83b4239e1d780c58ddf55f7533f6ca49dbddba73
Author: Xiang Xiao <[email protected]>
AuthorDate: Tue Sep 1 19:47:13 2026 +0800

    arch/sim: switch nonblock setup to ioctl FIONBIO
    
    Update host_uart_start() to set stdin/stdout nonblocking via ioctl.
    
    Signed-off-by: Xiang Xiao <[email protected]>
---
 arch/sim/src/sim/posix/sim_hostuart.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

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 */
 

Reply via email to