aboutsummaryrefslogtreecommitdiff
path: root/qga/channel-win32.c
AgeCommit message (Collapse)AuthorFilesLines
2021-03-16qga: Add spaces around operatorAlexChen1-3/+4
Reported-by: Euler Robot <euler.robot@huawei.com> Signed-off-by: AlexChen <alex.chen@huawei.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> *fix 80+ char violation while we're here *fix w32 build breakage from changing INVALID_SET_FILE_POINTER definition from a cast to a subtraction Signed-off-by: Michael Roth <michael.roth@amd.com>
2020-03-09qga: Fix a memory leakPhilippe Mathieu-Daudé1-2/+2
The string returned by g_win32_error_message() has to be deallocated with g_free(). Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200228100726.8414-5-philmd@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2020-03-09qga: Improve error report by calling error_setg_win32()Philippe Mathieu-Daudé1-1/+2
Use error_setg_win32() which adds a hint similar to strerror(errno)). Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200228100726.8414-4-philmd@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2018-10-31qga-win: report specific error when failing to open channelMichael Roth1-1/+2
Useful in general, but especially now that errors might occur more frequently with --retry-path set. Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2018-06-01qga: use local path for local headersMichael S. Tsirkin1-2/+2
When pulling in headers that are in the same directory as the C file (as opposed to one in include/), we should use its relative path, without a directory. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
2017-03-06qga: add systemd socket activation supportStefan Hajnoczi1-1/+1
AF_UNIX and AF_VSOCK listen sockets can be passed in by systemd on startup. This allows systemd to manage the listen socket until the first client connects and between restarts. Advantages of socket activation are that parallel startup of network services becomes possible and that unused daemons do not consume memory. The key to achieving this is the LISTEN_FDS environment variable, which is a stable ABI as shown here: https://www.freedesktop.org/wiki/Software/systemd/InterfacePortabilityAndStabilityChart/ We could link against libsystemd and use sd_listen_fds(3) but it's easy to implement the tiny LISTEN_FDS ABI so that qemu-ga does not depend on libsystemd. Some systems may not have systemd installed and wish to avoid the dependency. Other init systems or socket activation servers may implement the same ABI without systemd involvement. Test as follows: $ cat ~/.config/systemd/user/qga.service [Unit] Description=qga [Service] WorkingDirectory=/tmp ExecStart=/path/to/qemu-ga --logfile=/tmp/qga.log --pidfile=/tmp/qga.pid --statedir=/tmp $ cat ~/.config/systemd/user/qga.socket [Socket] ListenStream=/tmp/qga.sock [Install] WantedBy=default.target $ systemctl --user daemon-reload $ systemctl --user start qga.socket $ nc -U /tmp/qga.sock Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2016-06-07qga: Remove unnecessary glib.h includesPeter Maydell1-1/+0
Remove glib.h includes, as it is provided by osdep.h. This commit was created with scripts/clean-includes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Eric Blake <eblake@redhat.com> Tested-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2016-05-18Fix some typos found by codespellStefan Weil1-1/+1
Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2016-02-04qga: Clean up includesPeter Maydell1-4/+1
Clean up includes so that osdep.h is included first and headers which it implies are not included manually. This commit was created with scripts/clean-includes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1454089805-5470-9-git-send-email-peter.maydell@linaro.org
2015-10-19qga: fix uninitialized value warning for win32Michael Roth1-1/+1
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-10-19qga: Use g_new() & friends where that makes obvious senseMarkus Armbruster1-1/+1
g_new(T, n) is neater than g_malloc(sizeof(T) * n). It's also safer, for two reasons. One, it catches multiplication overflowing size_t. Two, it returns T * rather than void *, which lets the compiler catch more type errors. This commit only touches allocations with size arguments of the form sizeof(T). Same Coccinelle semantic patch as in commit b45c03f. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-06-17qemu-ga: debug printouts to help troubleshoot installationYossi Hindin1-1/+1
Debug printouts extended, helps installation troubleshooting Signed-off-by: Yossi Hindin <yhindin@redhat.com> Message-Id: <1430913460-13174-3-git-send-email-yhindin@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-02-23qemu-ga: isa-serial support on WindowsMiki Mishael1-2/+18
Add support for isa-serial method for qemu-ga on Windows, Added -p command line parameter for serial port name specification, e.g. "-p COM15". Signed-off-by: Miki Mishael <mmishael@redhat.com> Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com> *added default isa-serial path to help output Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-05-12remove double semicolonsDong Xu Wang1-1/+1
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-03-11qemu-ga: fix confusing GAChannelMethod comparisonStefan Hajnoczi1-1/+1
In commit 7868e26e5930f49ca942311885776b938dcf3b77 ("qemu-ga: add initial win32 support") support was added for qemu-ga on Windows using virtio-serial. Other channel methods (ISA serial and UNIX domain socket) are not supported on Windows. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-03-19qemu-ga: for w32, fix leaked handle ov.hEvent in ga_channel_write()Jeff Cody1-0/+4
In the function ga_channel_write(), the handle ov.hEvent is created by the call to CreateEvent(). However, the handle is not closed prior to the function return. This patch closes the handle before the return of the function. Kudos to Paolo Bonzini for spotting this bug. Signed-off-by: Jeff Cody <jcody@redhat.com> Acked-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-02-23qemu-ga: add initial win32 supportMichael Roth1-0/+340
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.