@@ -664,8 +664,10 @@ static CharDriverState *qemu_chr_open_pipe(QemuOpts *opts)
static uint8_t term_fifo[TERM_FIFO_MAX_SIZE];
static int term_fifo_size;
-static int stdio_read_poll(void *opaque)
+static void stdio_read(void *opaque)
{
+ int size;
+ uint8_t buf[1];
CharDriverState *chr = opaque;
/* try to flush the queue if needed */
@@ -673,19 +675,9 @@ static int stdio_read_poll(void *opaque)
qemu_chr_read(chr, term_fifo, 1);
term_fifo_size = 0;
}
- /* see if we can absorb more chars */
- if (term_fifo_size == 0)
- return 1;
- else
- return 0;
-}
-
-static void stdio_read(void *opaque)
-{
- int size;
- uint8_t buf[1];
- CharDriverState *chr = opaque;
-
+ if (term_fifo_size != 0) {
+ return;
+ }
size = read(0, buf, 1);
if (size == 0) {
/* stdin has been closed. Remove it from the active list. */
@@ -757,7 +749,7 @@ static CharDriverState *qemu_chr_open_stdio(QemuOpts *opts)
return NULL;
chr = qemu_chr_open_fd(0, 1);
chr->chr_close = qemu_chr_close_stdio;
- qemu_set_fd_handler2(0, stdio_read_poll, stdio_read, NULL, chr);
+ qemu_set_fd_handler(0, stdio_read, NULL, chr);
stdio_nb_clients++;
term_init(opts);
This way we can remove the poll test Signed-off-by: Juan Quintela <quintela@redhat.com> --- qemu-char.c | 22 +++++++--------------- 1 files changed, 7 insertions(+), 15 deletions(-)