xiaoxiang781216 opened a new pull request, #20032:
URL: https://github.com/apache/nuttx/pull/20032

   ## Summary
   - Set both stdin (fd 0) and stdout (fd 1) to nonblocking via 
`ioctl(FIONBIO)` in `host_uart_start()`.
   - When the sim is connected via pipe (e.g. by an automation tool) and the 
host side does not read stdout in time, the pipe buffer fills up and `write(1, 
...)` blocks the entire sim process. This happens inside `host_uninterruptible` 
(irq disabled), so the NuttX scheduler is completely frozen and all threads 
stop.
   - With nonblocking I/O, `write()` returns `EAGAIN` instead; the TX data 
stays in the NuttX xmit buffer and `sim_tty_work` retries every 1ms until the 
pipe has space.
   
   ## Impact
   - Only affects the sim platform host UART setup 
(`arch/sim/src/sim/posix/sim_hostuart.c`), no functional change for interactive 
terminal usage.
   
   ## Testing
   Built and booted `sim:nsh` on Linux, console I/O works as before; verified 
the sim no longer freezes when stdout is a pipe that is not drained by the 
reader.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to