Commit f6a6981
committed
arch/sim: set stdin/stdout nonblocking in host_uart_start()
When NuttX sim is connected via pipe (e.g. by an automation tool),
if 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.
Set both stdin and stdout to nonblocking via ioctl(FIONBIO) so that
read()/write() return EAGAIN instead of blocking. The TX data stays
in the NuttX xmit buffer and sim_tty_work retries every 1ms until
the pipe has space.
Signed-off-by: chenzihan1 <chenzihan1@xiaomi.com>
Signed-off-by: ligd <liguangdi1@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>1 parent b939b11 commit f6a6981
1 file changed
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
98 | 100 | | |
99 | 101 | | |
100 | 102 | | |
| |||
103 | 105 | | |
104 | 106 | | |
105 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
106 | 116 | | |
107 | 117 | | |
108 | 118 | | |
| |||
0 commit comments