From 7868e26e5930f49ca942311885776b938dcf3b77 Mon Sep 17 00:00:00 2001 From: Michael Roth Date: Fri, 20 Jan 2012 19:01:30 -0600 Subject: qemu-ga: add initial win32 support This adds a win32 channel implementation that makes qemu-ga functional on Windows using virtio-serial (unix-listen/isa-serial not currently implemented). Unlike with the posix implementation, we do not use GIOChannel for the following reasons: - glib calls stat() on an fd to check whether S_IFCHR is set, which is the case for virtio-serial on win32. Because of that, a one-time check to determine whether the channel is readable is done by making a call to PeekConsoleInput(), which reports the underlying handle is not a valid console handle, and thus we can never read from the channel. - if one goes as far as to "trick" glib into thinking it is a normal file descripter, the buffering is done in such a way that data written to the output stream will subsequently result in that same data being read back as if it were input, causing an error loop. furthermore, a forced flush of the channel only moves the data into a secondary buffer managed by glib, so there's no way to prevent output from getting read back as input. The implementation here ties into the glib main loop by implementing a custom GSource that continually submits asynchronous/overlapped I/O to fill an GAChannel-managed read buffer, and tells glib to poll the corresponding event handle for a completion whenever there is no data/RPC in the read buffer to notify the main application about. --- Makefile.objs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile.objs') diff --git a/Makefile.objs b/Makefile.objs index 39c7f4ef74..67deac8067 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -426,7 +426,7 @@ common-obj-y += qmp.o hmp.o qga-nested-y = commands.o guest-agent-command-state.o qga-nested-$(CONFIG_POSIX) += commands-posix.o channel-posix.o -qga-nested-$(CONFIG_WIN32) += commands-win32.o +qga-nested-$(CONFIG_WIN32) += commands-win32.o channel-win32.o qga-obj-y = $(addprefix qga/, $(qga-nested-y)) qga-obj-y += qemu-ga.o module.o qga-obj-$(CONFIG_WIN32) += oslib-win32.o -- cgit v1.2.3