qga: non-blocking fd cleanups
cover qga: non-blocking fd cleanups
This patchset is reincarnation of one patch discussed in the scope of QEMU 2.4 and rejected for that time. Actually we should use non-blocking descriptors in QGA on Windows in guest-file-open exactly like was done for Posix.
PATCH 1/2 qga: drop hand-made guest_file_toggle_flags helper
We'd better use generic qemu_set_nonblock directly.
--- qga/commands-posix.c | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-)
qga/commands-posix.c +2 -25
@@ -28,6 +28,7 @@#include "qapi/qmp/qerror.h" #include "qemu/queue.h" #include "qemu/host-utils.h" +#include "qemu/sockets.h" #ifndef CONFIG_HAS_ENVIRON #ifdef __APPLE__
@@ -385,27 +386,6 @@ safe_open_or_create(const char *path, const char *mode, Error **errp)return NULL ; } -static int guest_file_toggle_flags (int fd,int flags,bool set,Error **err) -{ -int ret, old_flags; - - old_flags =fcntl (fd,F_GETFL ); -if (old_flags ==-1 ) { -error_setg_errno (err, errno,QERR_QGA_COMMAND_FAILED , -"failed to fetch filehandle flags" ); -return -1 ; - } - - ret =fcntl (fd,F_SETFL , set ? (old_flags | flags) : (old_flags & ~flags)); -if (ret ==-1 ) { -error_setg_errno (err, errno,QERR_QGA_COMMAND_FAILED , -"failed to set filehandle flags" ); -return -1 ; - } - -return ret; -} -int64_t qmp_guest_file_open (const char *path,bool has_mode,const char *mode,Error **errp) {
@@ -426,10 +406,7 @@ int64_t qmp_guest_file_open(const char *path, bool has_mode, const char *mode,/* set fd non-blocking to avoid common use cases (like reading from a * named pipe) from hanging the agent */ -if (guest_file_toggle_flags (fileno (fh),O_NONBLOCK , true, errp) <0 ) { -fclose (fh); -return -1 ; - } +qemu_set_nonblock (fileno (fh)); handle =guest_file_handle_add (fh, errp);if (handle <0 ) {
Signature · 1 line
2.1.4
PATCH 2/2 qga: set file descriptors in qmp_guest_file_open non-blocking on Win32
In reply to Denis V. LunevFrom: Olga Krishtal <[email protected]>
Set fd non-blocking to avoid common use cases (like reading from a named pipe) from hanging the agent. This was missed in the original code.
Restore compatibility with Posix implementation.
The patch adds Win32 specific implementation of qemu_set_nonblock.
On Windows OS there is a separate API for changing flags of file, pipes and sockets. Portable way to change file descriptor flags requires to detect file descriptor type and proper actions depending of that type. The patch adds wrapper qemu_set_fd_nonblocking into Windows specific code to handle this stuff properly.
The only problem is that qemu_set_nonblock is void but this should not be a big deal.
--- qga/commands-win32.c | 6 ++++++ util/oslib-win32.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 53 insertions(+), 5 deletions(-)
qga/commands-win32.c +6 -0
@@ -34,6 +34,7 @@#include "qapi/qmp/qerror.h" #include "qemu/queue.h" #include "qemu/host-utils.h" +#include "qemu/sockets.h" #ifndef SHTDN_REASON_FLAG_PLANNED #define SHTDN_REASON_FLAG_PLANNED 0x80000000
@@ -158,6 +159,11 @@ int64_t qmp_guest_file_open(const char *path, bool has_mode,return -1 ; } +/* set fd non-blocking to avoid common use cases (like reading from a +* named pipe) from hanging the agent +*/ +qemu_set_nonblock (fileno (fh)); + fd =guest_file_handle_add (fh, errp);if (fd <0 ) {CloseHandle (&fh);
util/oslib-win32.c +47 -5
64 lines not on this page · raw message
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 1/2] qga: drop hand-made guest_file_toggle_flags helper
In reply to Denis V. LunevQuoted 9 lines · Denis V. Lunev
We'd better use generic
qemu_set_nonblockdirectly.Signed-off-by Denis V. Lunev <[email protected]>Reviewed-by Yuri Pudgorodskiy <[email protected]>CC Michael Roth <[email protected]>--- qga/commands-posix.c | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-)
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 10 lines · Denis V. Lunev
This patchset is reincarnation of one patch discussed in the scope of QEMU 2.4 and rejected for that time. Actually we should use non-blocking descriptors in QGA on Windows in guest-file-open exactly like was done for Posix.
Signed-off-by Denis V. Lunev <[email protected]>Signed-off-by Olga Krishtal <[email protected]>Reviewed-by Yuri Pudgorodskiy <[email protected]>CC Michael Roth <[email protected]>
ping
Re: [Qemu-devel] [PATCH 2/2] qga: set file descriptors in qmp_guest_file_open non-blocking on Win32
In reply to Denis V. LunevQuoting Denis V. Lunev (2015-10-07 05:59:34)
Quoted 110 lines
From: Olga Krishtal <[email protected]>
Set fd non-blocking to avoid common use cases (like reading from a named pipe) from hanging the agent. This was missed in the original code.
Restore compatibility with Posix implementation.
The patch adds Win32 specific implementation of
qemu_set_nonblock.On Windows OS there is a separate API for changing flags of file, pipes and sockets. Portable way to change file descriptor flags requires to detect file descriptor type and proper actions depending of that type. The patch adds wrapper
qemu_set_fd_nonblockinginto Windows specific code to handle this stuff properly.The only problem is that
qemu_set_nonblockis void but this should not be a big deal.Signed-off-by Olga Krishtal <[email protected]>Signed-off-by Denis V. Lunev <[email protected]>Reviewed-by Yuri Pudgorodskiy <[email protected]>CC Michael Roth <[email protected]>CC Stefan Weil <[email protected]>--- qga/commands-win32.c | 6 ++++++ util/oslib-win32.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 53 insertions(+), 5 deletions(-)qga/commands-win32.c +6
-0@@ -34,6 +34,7 @@#include "qapi/qmp/qerror.h" #include "qemu/queue.h" #include "qemu/host-utils.h" +#include "qemu/sockets.h" #ifndef SHTDN_REASON_FLAG_PLANNED #define SHTDN_REASON_FLAG_PLANNED 0x80000000@@ -158,6 +159,11 @@ int64_t qmp_guest_file_open(const char *path, bool has_mode,return -1 ; } +/* set fd non-blocking to avoid common use cases (like reading from a +* named pipe) from hanging the agent +*/ +qemu_set_nonblock (fileno (fh)); + fd =guest_file_handle_add (fh, errp);if (fd <0 ) {CloseHandle (&fh);util/oslib-win32.c +42
-3@@ -121,17 +121,59 @@ struct tm *localtime_r(const time_t *timep, struct tm *result) }#endif /* CONFIG_LOCALTIME_R */ -void qemu_set_block (int fd) +static void qemu_set_fd_nonblocking (int fd,bool nonblocking) { -unsigned long opt =0 ; -WSAEventSelect (fd,NULL ,0 ); +HANDLE handle; +DWORD file_type, pipe_state; + + handle = (HANDLE )_get_osfhandle (fd); +if (handle ==INVALID_HANDLE_VALUE ) { +return ; + } + + file_type =GetFileType (handle); +if (file_type !=FILE_TYPE_PIPE ) { +return ; + } + +/* If file_type == FILE_TYPE_PIPE, according to msdn +* the specified file is socket or named pipe */ +if (GetNamedPipeHandleState (handle, &pipe_state,NULL , +NULL ,NULL ,NULL ,0 )) { +/* The fd is named pipe fd */ +if (!nonblocking == !(pipe_state &PIPE_NOWAIT )) { +/* In this case we do not need perform any operation, because +* nonblocking = true and PIPE_NOWAIT is already set or +* nonblocking = false and PIPE_NOWAIT is not set */ +return ; + } + +if (nonblocking) { + pipe_state |=PIPE_NOWAIT ; + }else { + pipe_state &= ~PIPE_NOWAIT ; + } + +SetNamedPipeHandleState (handle, &pipe_state,NULL ,NULL ); +return ; + } + +/* The fd is socket fd */ +unsigned long opt = (unsigned long )nonblocking; +if (!nonblocking) { +WSAEventSelect (fd,NULL ,0 ); + }ioctlsocket (fd,FIONBIO , &opt); } +void qemu_set_block (int fd)
util/oslib-win32.c struct tm *localtime_r(const time_t *timep, struct tm *result) · line 177
Quoted 10 lines
util/oslib-win32.c +5
-2+{ +qemu_set_fd_nonblocking (fd, false); +} +void qemu_set_nonblock (int fd) { -unsigned long opt =1 ; -ioctlsocket (fd,FIONBIO , &opt); +qemu_set_fd_nonblocking (fd, true);qemu_fd_register (fd);
This still potentially calls qemu_fd_register() on a non-socket FD as noted in prior review. I think the fix is trivial, but if you can change and re-test that would be ideal.
Since guest-file* already supports reading/writing to w32 pipes I can pick this up during soft-freeze if it comes to that.
Since we're still taking the approach of generalizing qemu_set_nonblock() for win32 I'd really prefer to get Stefan's Ack/Reviewed-by before applying.
Quoted 5 lines
util/oslib-win32.c +0
-0}Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH 2/2] qga: set file descriptors in qmp_guest_file_open non-blocking on Win32
Quoted 125 lines · Michael Roth
Quoting Denis V. Lunev (2015-10-07 05:59:34)
Quoted 110 lines
From: Olga Krishtal <[email protected]>
Set fd non-blocking to avoid common use cases (like reading from a named pipe) from hanging the agent. This was missed in the original code.
Restore compatibility with Posix implementation.
The patch adds Win32 specific implementation of
qemu_set_nonblock.On Windows OS there is a separate API for changing flags of file, pipes and sockets. Portable way to change file descriptor flags requires to detect file descriptor type and proper actions depending of that type. The patch adds wrapper
qemu_set_fd_nonblockinginto Windows specific code to handle this stuff properly.The only problem is that
qemu_set_nonblockis void but this should not be a big deal.Signed-off-by Olga Krishtal <[email protected]>Signed-off-by Denis V. Lunev <[email protected]>Reviewed-by Yuri Pudgorodskiy <[email protected]>CC Michael Roth <[email protected]>CC Stefan Weil <[email protected]>--- qga/commands-win32.c | 6 ++++++ util/oslib-win32.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 53 insertions(+), 5 deletions(-)qga/commands-win32.c +6
-0@@ -34,6 +34,7 @@#include "qapi/qmp/qerror.h" #include "qemu/queue.h" #include "qemu/host-utils.h" +#include "qemu/sockets.h" #ifndef SHTDN_REASON_FLAG_PLANNED #define SHTDN_REASON_FLAG_PLANNED 0x80000000@@ -158,6 +159,11 @@ int64_t qmp_guest_file_open(const char *path, bool has_mode,return -1 ; } +/* set fd non-blocking to avoid common use cases (like reading from a +* named pipe) from hanging the agent +*/ +qemu_set_nonblock (fileno (fh)); + fd =guest_file_handle_add (fh, errp);if (fd <0 ) {CloseHandle (&fh);util/oslib-win32.c +42
-3@@ -121,17 +121,59 @@ struct tm *localtime_r(const time_t *timep, struct tm *result) }#endif /* CONFIG_LOCALTIME_R */ -void qemu_set_block (int fd) +static void qemu_set_fd_nonblocking (int fd,bool nonblocking) { -unsigned long opt =0 ; -WSAEventSelect (fd,NULL ,0 ); +HANDLE handle; +DWORD file_type, pipe_state; + + handle = (HANDLE )_get_osfhandle (fd); +if (handle ==INVALID_HANDLE_VALUE ) { +return ; + } + + file_type =GetFileType (handle); +if (file_type !=FILE_TYPE_PIPE ) { +return ; + } + +/* If file_type == FILE_TYPE_PIPE, according to msdn +* the specified file is socket or named pipe */ +if (GetNamedPipeHandleState (handle, &pipe_state,NULL , +NULL ,NULL ,NULL ,0 )) { +/* The fd is named pipe fd */ +if (!nonblocking == !(pipe_state &PIPE_NOWAIT )) { +/* In this case we do not need perform any operation, because +* nonblocking = true and PIPE_NOWAIT is already set or +* nonblocking = false and PIPE_NOWAIT is not set */ +return ; + } + +if (nonblocking) { + pipe_state |=PIPE_NOWAIT ; + }else { + pipe_state &= ~PIPE_NOWAIT ; + } + +SetNamedPipeHandleState (handle, &pipe_state,NULL ,NULL ); +return ; + } + +/* The fd is socket fd */ +unsigned long opt = (unsigned long )nonblocking; +if (!nonblocking) { +WSAEventSelect (fd,NULL ,0 ); + }ioctlsocket (fd,FIONBIO , &opt); } +void qemu_set_block (int fd)util/oslib-win32.c struct tm *localtime_r(const time_t *timep, struct tm *result) · line 177
Quoted 10 lines
util/oslib-win32.c +5
-2+{ +qemu_set_fd_nonblocking (fd, false); +} +void qemu_set_nonblock (int fd) { -unsigned long opt =1 ; -ioctlsocket (fd,FIONBIO , &opt); +qemu_set_fd_nonblocking (fd, true);qemu_fd_register (fd);This still potentially calls
qemu_fd_register()on a non-socket FD as noted in prior review. I think the fix is trivial, but if you can change and re-test that would be ideal.
Quoted 6 lines
Since guest-file* already supports reading/writing to w32 pipes I can pick this up during soft-freeze if it comes to that.
Since we're still taking the approach of generalizing
qemu_set_nonblock()for win32 I'd really prefer to get Stefan's Ack/Reviewed-by before applying.
you are perfectly correct, I have missed this fact from previous discussion. Sure this needs to be addressed.
Thank you for a review.
Den
Re: [Qemu-devel] [PATCH 2/2] qga: set file descriptors in qmp_guest_file_open non-blocking on Win32
In reply to Michael RothHi,
please see my inline comments below.
Am 12.10.2015 um 19:38 schrieb Michael Roth:
Quoted 74 lines
Quoting Denis V. Lunev (2015-10-07 05:59:34)
Quoted 73 lines
From: Olga Krishtal <[email protected]>
Set fd non-blocking to avoid common use cases (like reading from a named pipe) from hanging the agent. This was missed in the original code.
Restore compatibility with Posix implementation.
The patch adds Win32 specific implementation of
qemu_set_nonblock.On Windows OS there is a separate API for changing flags of file, pipes and sockets. Portable way to change file descriptor flags requires to detect file descriptor type and proper actions depending of that type. The patch adds wrapper
qemu_set_fd_nonblockinginto Windows specific code to handle this stuff properly.The only problem is that
qemu_set_nonblockis void but this should not be a big deal.Signed-off-by Olga Krishtal <[email protected]>Signed-off-by Denis V. Lunev <[email protected]>Reviewed-by Yuri Pudgorodskiy <[email protected]>CC Michael Roth <[email protected]>CC Stefan Weil <[email protected]>--- qga/commands-win32.c | 6 ++++++ util/oslib-win32.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 53 insertions(+), 5 deletions(-)qga/commands-win32.c +6
-0@@ -34,6 +34,7 @@#include "qapi/qmp/qerror.h" #include "qemu/queue.h" #include "qemu/host-utils.h" +#include "qemu/sockets.h" #ifndef SHTDN_REASON_FLAG_PLANNED #define SHTDN_REASON_FLAG_PLANNED 0x80000000@@ -158,6 +159,11 @@ int64_t qmp_guest_file_open(const char *path, bool has_mode,return -1 ; } +/* set fd non-blocking to avoid common use cases (like reading from a +* named pipe) from hanging the agent +*/ +qemu_set_nonblock (fileno (fh)); + fd =guest_file_handle_add (fh, errp);if (fd <0 ) {CloseHandle (&fh);util/oslib-win32.c +8
-3@@ -121,17 +121,59 @@ struct tm *localtime_r(const time_t *timep, struct tm *result) }#endif /* CONFIG_LOCALTIME_R */ -void qemu_set_block (int fd) +static void qemu_set_fd_nonblocking (int fd,bool nonblocking) { -unsigned long opt =0 ; -WSAEventSelect (fd,NULL ,0 ); +HANDLE handle; +DWORD file_type, pipe_state; + + handle = (HANDLE )_get_osfhandle (fd); +if (handle ==INVALID_HANDLE_VALUE ) { +return ; + }
Quoted 8 lines
util/oslib-win32.c struct tm *localtime_r(const time_t *timep, struct tm *result) · line 140
Quoted 8 lines
util/oslib-win32.c +8
-0+ + file_type =GetFileType (handle); +if (file_type !=FILE_TYPE_PIPE ) { +return ; + } + +/* If file_type == FILE_TYPE_PIPE, according to msdn +* the specified file is socket or named pipe */
... or an anonymous pipe.
Quoted 3 lines
util/oslib-win32.c struct tm *localtime_r(const time_t *timep, struct tm *result) · line 143
Quoted 3 lines
util/oslib-win32.c +3
-0+if (GetNamedPipeHandleState (handle, &pipe_state,NULL , +NULL ,NULL ,NULL ,0 )) { +/* The fd is named pipe fd */
pipe_state could be declared here.
Quoted 11 lines
Quoted 11 lines
util/oslib-win32.c +11
-0+if (!nonblocking == !(pipe_state &PIPE_NOWAIT )) { +/* In this case we do not need perform any operation, because +* nonblocking = true and PIPE_NOWAIT is already set or +* nonblocking = false and PIPE_NOWAIT is not set */ +return ; + } + +if (nonblocking) { + pipe_state |=PIPE_NOWAIT ; + }else { + pipe_state &= ~PIPE_NOWAIT ;
Quoted 8 lines
util/oslib-win32.c struct tm *localtime_r(const time_t *timep, struct tm *result) · line 162
Quoted 8 lines
util/oslib-win32.c +8
-0+ } + +SetNamedPipeHandleState (handle, &pipe_state,NULL ,NULL ); +return ; + } + +/* The fd is socket fd */ +unsigned long opt = (unsigned long )nonblocking;
The QEMU style still requires variable declarations at the beginning of a code block.
Quoted 6 lines
Quoted 6 lines
util/oslib-win32.c +3
-0+if (!nonblocking) { +WSAEventSelect (fd,NULL ,0 ); + }ioctlsocket (fd,FIONBIO , &opt); }
Quoted 15 lines
util/oslib-win32.c struct tm *localtime_r(const time_t *timep, struct tm *result) · line 177
Quoted 11 lines
util/oslib-win32.c +6
-2+void qemu_set_block (int fd) +{ +qemu_set_fd_nonblocking (fd, false); +} +void qemu_set_nonblock (int fd) { -unsigned long opt =1 ; -ioctlsocket (fd,FIONBIO , &opt); +qemu_set_fd_nonblocking (fd, true);qemu_fd_register (fd);This still potentially calls
qemu_fd_register()on a non-socket FD as noted in prior review. I think the fix is trivial, but if you can change and re-test that would be ideal.
Yes.
Quoted 9 lines
Since guest-file* already supports reading/writing to w32 pipes I can pick this up during soft-freeze if it comes to that.
Since we're still taking the approach of generalizing
qemu_set_nonblock()for win32 I'd really prefer to get Stefan's Ack/Reviewed-by before applying.Quoted 1 line
util/oslib-win32.c +0
-0}
I'm sorry that I cannot run any tests, but as far as I can see, the code will be fine if all the notes are taken into account.
Regards
Stefan
Re: [Qemu-devel] [PATCH 2/2] qga: set file descriptors in qmp_guest_file_open non-blocking on Win32
Quoted 80 lines · Stefan Weil
Hi,
please see my inline comments below.
Am 12.10.2015 um 19:38 schrieb Michael Roth:
Quoted 75 lines
Quoting Denis V. Lunev (2015-10-07 05:59:34)
Quoted 74 lines
From: Olga Krishtal <[email protected]>
Set fd non-blocking to avoid common use cases (like reading from a named pipe) from hanging the agent. This was missed in the original code.
Restore compatibility with Posix implementation.
The patch adds Win32 specific implementation of
qemu_set_nonblock.On Windows OS there is a separate API for changing flags of file, pipes and sockets. Portable way to change file descriptor flags requires to detect file descriptor type and proper actions depending of that type. The patch adds wrapper
qemu_set_fd_nonblockinginto Windows specific code to handle this stuff properly.The only problem is that
qemu_set_nonblockis void but this should not be a big deal.Signed-off-by Olga Krishtal <[email protected]>Signed-off-by Denis V. Lunev <[email protected]>Reviewed-by Yuri Pudgorodskiy <[email protected]>CC Michael Roth <[email protected]>CC Stefan Weil <[email protected]>--- qga/commands-win32.c | 6 ++++++ util/oslib-win32.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 53 insertions(+), 5 deletions(-)qga/commands-win32.c +6
-0@@ -34,6 +34,7 @@#include "qapi/qmp/qerror.h" #include "qemu/queue.h" #include "qemu/host-utils.h" +#include "qemu/sockets.h" #ifndef SHTDN_REASON_FLAG_PLANNED #define SHTDN_REASON_FLAG_PLANNED 0x80000000@@ -158,6 +159,11 @@ int64_t qmp_guest_file_open(const char *path, bool has_mode,return -1 ; } +/* set fd non-blocking to avoid common use cases (like reading from a +* named pipe) from hanging the agent +*/ +qemu_set_nonblock (fileno (fh)); + fd =guest_file_handle_add (fh, errp);if (fd <0 ) {CloseHandle (&fh);util/oslib-win32.c +9
-3@@ -121,17 +121,59 @@ struct tm *localtime_r(const time_t *timep, struct tm *result) }#endif /* CONFIG_LOCALTIME_R */ -void qemu_set_block (int fd) +static void qemu_set_fd_nonblocking (int fd,bool nonblocking) { -unsigned long opt =0 ; -WSAEventSelect (fd,NULL ,0 ); +HANDLE handle; +DWORD file_type, pipe_state; + + handle = (HANDLE )_get_osfhandle (fd); +if (handle ==INVALID_HANDLE_VALUE ) { +return ; + } +
Quoted 8 lines
Quoted 7 lines
util/oslib-win32.c struct tm *localtime_r(const time_t *timep, struct tm *result) · line 140
Quoted 7 lines
util/oslib-win32.c +7
-0+ file_type =GetFileType (handle); +if (file_type !=FILE_TYPE_PIPE ) { +return ; + } + +/* If file_type == FILE_TYPE_PIPE, according to msdn +* the specified file is socket or named pipe */ ... or an anonymous pipe.
ok
Quoted 4 lines
Quoted 3 lines
util/oslib-win32.c struct tm *localtime_r(const time_t *timep, struct tm *result) · line 143
Quoted 3 lines
util/oslib-win32.c +3
-0+if (GetNamedPipeHandleState (handle, &pipe_state,NULL , +NULL ,NULL ,NULL ,0 )) { +/* The fd is named pipe fd */
pipe_statecould be declared here.
not ok. pipe_state is initialized in GetNamedPipeHandleState above, which is in the main scope of the function
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
util/oslib-win32.c +13
-0+if (!nonblocking == !(pipe_state &PIPE_NOWAIT )) { +/* In this case we do not need perform any operation, because +* nonblocking = true and PIPE_NOWAIT is already set or +* nonblocking = false and PIPE_NOWAIT is not set */ +return ; + } + +if (nonblocking) { + pipe_state |=PIPE_NOWAIT ; + }else { + pipe_state &= ~PIPE_NOWAIT ; + } +
Quoted 8 lines
Quoted 6 lines
util/oslib-win32.c struct tm *localtime_r(const time_t *timep, struct tm *result) · line 162
Quoted 6 lines
util/oslib-win32.c +6
-0+SetNamedPipeHandleState (handle, &pipe_state,NULL ,NULL ); +return ; + } + +/* The fd is socket fd */ +unsigned long opt = (unsigned long )nonblocking;The QEMU style still requires variable declarations at the beginning of a code block.
ok
Quoted 20 lines
Quoted 6 lines
Quoted 6 lines
util/oslib-win32.c +3
-0+if (!nonblocking) { +WSAEventSelect (fd,NULL ,0 ); + }ioctlsocket (fd,FIONBIO , &opt); }Quoted 14 lines
util/oslib-win32.c struct tm *localtime_r(const time_t *timep, struct tm *result) · line 177
Quoted 11 lines
util/oslib-win32.c +6
-2+void qemu_set_block (int fd) +{ +qemu_set_fd_nonblocking (fd, false); +} +void qemu_set_nonblock (int fd) { -unsigned long opt =1 ; -ioctlsocket (fd,FIONBIO , &opt); +qemu_set_fd_nonblocking (fd, true);qemu_fd_register (fd);This still potentially calls
qemu_fd_register()on a non-socket FD as noted in prior review. I think the fix is trivial, but if you can change and re-test that would be ideal.
Quoted 1 line
Yes.
sure :) already discussed
Quoted 14 lines
Quoted 8 lines
Since guest-file* already supports reading/writing to w32 pipes I can pick this up during soft-freeze if it comes to that.
Since we're still taking the approach of generalizing
qemu_set_nonblock()for win32 I'd really prefer to get Stefan's Ack/Reviewed-by before applying.Quoted 1 line
util/oslib-win32.c +0
-0}I'm sorry that I cannot run any tests, but as far as I can see, the code will be fine if all the notes are taken into account.
Regards
Stefan