summaryrefslogtreecommitdiffstats
path: root/qga/channel-posix.c
Commit message (Collapse)AuthorAgeFilesLines
* qga: Remove unnecessary glib.h includesPeter Maydell2016-06-071-1/+0Star
| | | | | | | | | | | 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>
* include/qemu/osdep.h: Don't include qapi/error.hMarkus Armbruster2016-03-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 57cb38b included qapi/error.h into qemu/osdep.h to get the Error typedef. Since then, we've moved to include qemu/osdep.h everywhere. Its file comment explains: "To avoid getting into possible circular include dependencies, this file should not include any other QEMU headers, with the exceptions of config-host.h, compiler.h, os-posix.h and os-win32.h, all of which are doing a similar job to this file and are under similar constraints." qapi/error.h doesn't do a similar job, and it doesn't adhere to similar constraints: it includes qapi-types.h. That's in excess of 100KiB of crap most .c files don't actually need. Add the typedef to qemu/typedefs.h, and include that instead of qapi/error.h. Include qapi/error.h in .c files that need it and don't get it now. Include qapi-types.h in qom/object.h for uint16List. Update scripts/clean-includes accordingly. Update it further to match reality: replace config.h by config-target.h, add sysemu/os-posix.h, sysemu/os-win32.h. Update the list of includes in the qemu/osdep.h comment quoted above similarly. This reduces the number of objects depending on qapi/error.h from "all of them" to less than a third. Unfortunately, the number depending on qapi-types.h shrinks only a little. More work is needed for that one. Signed-off-by: Markus Armbruster <armbru@redhat.com> [Fix compilation without the spice devel packages. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qga: Clean up includesPeter Maydell2016-02-041-6/+1Star
| | | | | | | | | | 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
* qga: handle G_IO_STATUS_AGAIN in ga_channel_write_all()Yuri Pudgorodskiy2015-10-201-12/+11Star
| | | | | | | | | | glib may return G_IO_STATUS_AGAIN which is actually not an error. Also fixed a bug when on incomplete write buf pointer was not adjusted. Signed-off-by: Yuri Pudgorodskiy <yur@virtuozzo.com> Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* qga: Use g_new() & friends where that makes obvious senseMarkus Armbruster2015-10-201-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>
* channel-posix: using qemu_set_nonblock() instead of fcntl(O_NONBLOCK)Gonglei2014-08-151-1/+1
| | | | | | | | | | | | | | 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> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* qemu-ga: Handle errors uniformely in ga_channel_open()Markus Armbruster2013-01-141-4/+7
| | | | | | | | | | | | | | | | | We detect errors in several places. One reports with g_error(), which calls abort(), the others report with g_critical(). Three of them exit(), three return false. Always report with g_critical(), and return false. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> *minor fix-up of commit msg Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* qemu-ga: Plug fd leak on ga_channel_open() error pathsMarkus Armbruster2013-01-141-0/+1
| | | | | | | | | | Spotted by Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* qemu-ga: Plug fd leak on ga_channel_listen_accept() error pathMarkus Armbruster2013-01-141-0/+1
| | | | | | | | | | Spotted by Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
* qga/channel-posix.c: Explicitly include string.hPeter Maydell2013-01-111-0/+1
| | | | | | | | | Explicitly include string.h to avoid warnings under MacOS X/clang about implicit declarations of strerror() and strlen(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* misc: move include files to include/qemu/Paolo Bonzini2012-12-191-2/+2
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qga/channel-posix.c: Include headers it needsEduardo Habkost2012-12-061-0/+5
| | | | | | | | | | | | | | | | Include: - <errno.h> for errno - <unistd.h> & <fcntl.h> for fcntl() - <stdlib.h> for exit() - "osdep.h" for qemu_open() Some of those headers were probably being included by accident because some other headers were including qemu-common.h, but those headers should eventually stop including qemu-common.h. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* qemu-ga: ask and print error information from qemu-socketsPaolo Bonzini2012-10-231-3/+5
| | | | | Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qemu-sockets: add Error ** to all functionsPaolo Bonzini2012-10-231-1/+1
| | | | | | | | This lets me adjust the clients to do proper error propagation first, thus avoiding temporary regressions in the quality of the error messages. Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qemu-ga: Implement alternative to O_ASYNCAndreas Färber2012-05-011-1/+17
| | | | | | | | | | ga_channel_open() was using open flag O_ASYNC for SIGIO-driven I/O. This breaks on illumos, so fall back to POSIX I_SETSIG ioctl (SIGPOLL). Signed-off-by: Lee Essen <lee.essen@nowonline.co.uk> Signed-off-by: Andreas Färber <andreas.faerber@web.de> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* qemu-ga: move channel/transport functionality into wrapper classMichael Roth2012-02-231-0/+246
This is mostly in preparation for the win32 port, which won't use GIO channels for reasons that will be made clearer later. Here the GAChannel class is just a loose wrapper around GIOChannel calls/callbacks, but we also roll in the logic/configuration for various channel types and managing unix socket connections, which makes the abstraction much more complete and further aids in the win32 port since isa-serial/unix-listen will not be supported initially. There's also a bit of refactoring in the main logic to consolidate the exit paths so we can do common cleanup for things like pid files, which weren't always cleaned up previously.