* [Qemu-devel] [PATCH 0/2] using qemu_set_nonblock() instead of fcntl(O_NONBLOCK)
@ 2014-08-11 9:34 arei.gonglei
2014-08-11 9:34 ` [Qemu-devel] [PATCH 1/2] qemu-char: " arei.gonglei
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: arei.gonglei @ 2014-08-11 9:34 UTC (permalink / raw)
To: qemu-devel
Cc: weidong.huang, mst, wangxinxin.wang, peter.huangpeng, Gonglei,
kraxel, stefanha, pbonzini
From: Gonglei <arei.gonglei@huawei.com>
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.
BTW, qemu_set_nonblock() locate qemu/socket.h, some other files
can not call it, such as tap-linux.c, maybe we can consider
pulling it out. Any ideas? Thanks.
Gonglei (2):
qemu-char: using qemu_set_nonblock() instead of fcntl(O_NONBLOCK)
channel-posix: using qemu_set_nonblock() instead of fcntl(O_NONBLOCK)
qemu-char.c | 4 ++--
qga/channel-posix.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
--
1.7.12.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 1/2] qemu-char: using qemu_set_nonblock() instead of fcntl(O_NONBLOCK)
2014-08-11 9:34 [Qemu-devel] [PATCH 0/2] using qemu_set_nonblock() instead of fcntl(O_NONBLOCK) arei.gonglei
@ 2014-08-11 9:34 ` arei.gonglei
2014-08-11 19:51 ` Eric Blake
2014-08-11 9:34 ` [Qemu-devel] [PATCH 2/2] channel-posix: " arei.gonglei
2014-08-12 9:02 ` [Qemu-devel] [PATCH 0/2] " Stefan Hajnoczi
2 siblings, 1 reply; 6+ messages in thread
From: arei.gonglei @ 2014-08-11 9:34 UTC (permalink / raw)
To: qemu-devel
Cc: weidong.huang, mst, wangxinxin.wang, peter.huangpeng, Gonglei,
kraxel, stefanha, pbonzini
From: Gonglei <arei.gonglei@huawei.com>
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 <wangxinxin.wang@huawei.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
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.7.12.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 2/2] channel-posix: using qemu_set_nonblock() instead of fcntl(O_NONBLOCK)
2014-08-11 9:34 [Qemu-devel] [PATCH 0/2] using qemu_set_nonblock() instead of fcntl(O_NONBLOCK) arei.gonglei
2014-08-11 9:34 ` [Qemu-devel] [PATCH 1/2] qemu-char: " arei.gonglei
@ 2014-08-11 9:34 ` arei.gonglei
2014-08-11 19:52 ` Eric Blake
2014-08-12 9:02 ` [Qemu-devel] [PATCH 0/2] " Stefan Hajnoczi
2 siblings, 1 reply; 6+ messages in thread
From: arei.gonglei @ 2014-08-11 9:34 UTC (permalink / raw)
To: qemu-devel
Cc: weidong.huang, mst, wangxinxin.wang, peter.huangpeng, Gonglei,
kraxel, stefanha, pbonzini
From: Gonglei <arei.gonglei@huawei.com>
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: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Wangxin <wangxinxin.wang@huawei.com>
---
qga/channel-posix.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/qga/channel-posix.c b/qga/channel-posix.c
index e65dda3..8aad4fe 100644
--- a/qga/channel-posix.c
+++ b/qga/channel-posix.c
@@ -42,7 +42,7 @@ static gboolean ga_channel_listen_accept(GIOChannel *channel,
g_warning("error converting fd to gsocket: %s", strerror(errno));
goto out;
}
- fcntl(client_fd, F_SETFL, O_NONBLOCK);
+ qemu_set_nonblock(client_fd);
ret = ga_channel_client_add(c, client_fd);
if (ret) {
g_warning("error setting up connection");
--
1.7.12.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] qemu-char: using qemu_set_nonblock() instead of fcntl(O_NONBLOCK)
2014-08-11 9:34 ` [Qemu-devel] [PATCH 1/2] qemu-char: " arei.gonglei
@ 2014-08-11 19:51 ` Eric Blake
0 siblings, 0 replies; 6+ messages in thread
From: Eric Blake @ 2014-08-11 19:51 UTC (permalink / raw)
To: arei.gonglei, qemu-devel
Cc: weidong.huang, mst, wangxinxin.wang, peter.huangpeng, kraxel,
stefanha, pbonzini
[-- Attachment #1: Type: text/plain, Size: 726 bytes --]
On 08/11/2014 03:34 AM, arei.gonglei@huawei.com wrote:
> From: Gonglei <arei.gonglei@huawei.com>
>
> 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 <wangxinxin.wang@huawei.com>
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> ---
> qemu-char.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 539 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] channel-posix: using qemu_set_nonblock() instead of fcntl(O_NONBLOCK)
2014-08-11 9:34 ` [Qemu-devel] [PATCH 2/2] channel-posix: " arei.gonglei
@ 2014-08-11 19:52 ` Eric Blake
0 siblings, 0 replies; 6+ messages in thread
From: Eric Blake @ 2014-08-11 19:52 UTC (permalink / raw)
To: arei.gonglei, qemu-devel
Cc: weidong.huang, mst, wangxinxin.wang, peter.huangpeng, kraxel,
stefanha, pbonzini
[-- Attachment #1: Type: text/plain, Size: 730 bytes --]
On 08/11/2014 03:34 AM, arei.gonglei@huawei.com wrote:
> From: Gonglei <arei.gonglei@huawei.com>
>
> 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: Gonglei <arei.gonglei@huawei.com>
> Signed-off-by: Wangxin <wangxinxin.wang@huawei.com>
> ---
> qga/channel-posix.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 539 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] using qemu_set_nonblock() instead of fcntl(O_NONBLOCK)
2014-08-11 9:34 [Qemu-devel] [PATCH 0/2] using qemu_set_nonblock() instead of fcntl(O_NONBLOCK) arei.gonglei
2014-08-11 9:34 ` [Qemu-devel] [PATCH 1/2] qemu-char: " arei.gonglei
2014-08-11 9:34 ` [Qemu-devel] [PATCH 2/2] channel-posix: " arei.gonglei
@ 2014-08-12 9:02 ` Stefan Hajnoczi
2 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2014-08-12 9:02 UTC (permalink / raw)
To: arei.gonglei
Cc: weidong.huang, mst, wangxinxin.wang, peter.huangpeng, qemu-devel,
kraxel, pbonzini
[-- Attachment #1: Type: text/plain, Size: 1008 bytes --]
On Mon, Aug 11, 2014 at 05:34:19PM +0800, arei.gonglei@huawei.com wrote:
> From: Gonglei <arei.gonglei@huawei.com>
>
> 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.
>
> BTW, qemu_set_nonblock() locate qemu/socket.h, some other files
> can not call it, such as tap-linux.c, maybe we can consider
> pulling it out. Any ideas? Thanks.
>
> Gonglei (2):
> qemu-char: using qemu_set_nonblock() instead of fcntl(O_NONBLOCK)
> channel-posix: using qemu_set_nonblock() instead of fcntl(O_NONBLOCK)
>
> qemu-char.c | 4 ++--
> qga/channel-posix.c | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
More of a chardev series but trivial and I've reviewed it.
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-08-12 9:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-11 9:34 [Qemu-devel] [PATCH 0/2] using qemu_set_nonblock() instead of fcntl(O_NONBLOCK) arei.gonglei
2014-08-11 9:34 ` [Qemu-devel] [PATCH 1/2] qemu-char: " arei.gonglei
2014-08-11 19:51 ` Eric Blake
2014-08-11 9:34 ` [Qemu-devel] [PATCH 2/2] channel-posix: " arei.gonglei
2014-08-11 19:52 ` Eric Blake
2014-08-12 9:02 ` [Qemu-devel] [PATCH 0/2] " Stefan Hajnoczi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.