[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 30/55] qemu-char: using qemu_set_nonblock() instead o
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 30/55] qemu-char: using qemu_set_nonblock() instead of fcntl(O_NONBLOCK) |
Date: |
Fri, 15 Aug 2014 18:06:37 +0100 |
From: Gonglei <address@hidden>
Technically, fcntl(soc, F_SETFL, O_NONBLOCK)
is incorrect since it clobbers all other file flags.
We can use F_GETFL to get the current flags, set or
clear the O_NONBLOCK flag, then use F_SETFL to set the flags.
Using the qemu_set_nonblock() wrapper.
Signed-off-by: Wangxin <address@hidden>
Signed-off-by: Gonglei <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
qemu-char.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/qemu-char.c b/qemu-char.c
index 6964a2d..b1e6a0a 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -975,7 +975,7 @@ static CharDriverState *qemu_chr_open_fd(int fd_in, int
fd_out)
s = g_malloc0(sizeof(FDCharDriver));
s->fd_in = io_channel_from_fd(fd_in);
s->fd_out = io_channel_from_fd(fd_out);
- fcntl(fd_out, F_SETFL, O_NONBLOCK);
+ qemu_set_nonblock(fd_out);
s->chr = chr;
chr->opaque = s;
chr->chr_add_watch = fd_chr_add_watch;
@@ -1062,7 +1062,7 @@ static CharDriverState *qemu_chr_open_stdio(ChardevStdio
*opts)
}
old_fd0_flags = fcntl(0, F_GETFL);
tcgetattr (0, &oldtty);
- fcntl(0, F_SETFL, O_NONBLOCK);
+ qemu_set_nonblock(0);
atexit(term_exit);
chr = qemu_chr_open_fd(0, 1);
--
1.9.3
- [Qemu-devel] [PULL 35/55] parallels: extend parallels format header with actual data values, (continued)
- [Qemu-devel] [PULL 35/55] parallels: extend parallels format header with actual data values, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 27/55] cmd646: switch cmd646_update_irq() to accept PCIDevice instead of PCIIDEState, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 36/55] parallels: replace tabs with spaces in block/parallels.c, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 29/55] cmd646: synchronise UDMA interrupt status with DMA interrupt status, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 33/55] dataplane: fail notifier setting gracefully, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 37/55] parallels: split check for parallels format in parallels_open, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 34/55] dataplane: stop trying on notifier error, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 38/55] parallels: 2TB+ parallels images support, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 40/55] ide: Fix segfault when flushing a device that doesn't exist, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 39/55] qemu-options: add missing -drive discard option to cmdline help, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 30/55] qemu-char: using qemu_set_nonblock() instead of fcntl(O_NONBLOCK),
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 41/55] libqtest: add QTEST_LOG for debugging qtest testcases, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 42/55] libqos: Correct mask to align size to PAGE_SIZE in malloc-pc, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 45/55] ide: only constrain read/write requests to drive size, not other types, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 43/55] libqos: Change free function called in malloc, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 44/55] virtio-blk: Correct bug in support for flexible descriptor layout, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 46/55] docs: Specification for the image fuzzer, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 47/55] image-fuzzer: Tool for fuzz tests execution, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 48/55] image-fuzzer: Fuzzing functions for qcow2 images, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 50/55] image-fuzzer: Public API for image-fuzzer/runner/runner.py, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 49/55] image-fuzzer: Generator of fuzzed qcow2 images, Stefan Hajnoczi, 2014/08/15