1
0
mirror of https://github.com/antonblanchard/microwatt.git synced 2026-01-11 23:43:15 +00:00

sim_console: Fix polling to check for POLLIN

Under some circumstances we get POLLHUP which we incorrectly
treat as having a character in the buffer.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This commit is contained in:
Benjamin Herrenschmidt 2020-06-19 20:27:31 +10:00
parent fb5c16d05e
commit fc4e13ae67

View File

@ -71,8 +71,11 @@ void sim_console_poll(unsigned char *__rt)
ret = poll(fdset, 1, 0); ret = poll(fdset, 1, 0);
//fprintf(stderr, "poll returns %d\n", ret); //fprintf(stderr, "poll returns %d\n", ret);
if (ret == 1) if (ret == 1) {
val = 1; if (fdset[0].revents & POLLIN)
val = 1;
// fprintf(stderr, "poll revents: 0x%x\n", fdset[0].revents);
}
to_std_logic_vector(val, __rt, 64); to_std_logic_vector(val, __rt, 64);
} }