qemu-e2k/qga
Luiz Capitulino dc8764f061 qemu-ga: guest-suspend: make the API synchronous
Currently, qemu-ga has a SIGCHLD handler that automatically reaps terminated
children processes. The idea is to avoid having qemu-ga commands blocked
waiting for children to terminate.

That approach has two problems:

 1. qemu-ga is unable to detect errors in the child, meaning that qemu-ga
    returns success even if the child fails to perform its task

 2. if a command does depend on the child exit status, the command has to
    play tricks to bypass the automatic reaper

Case 2 impacts the guest-suspend-* API, because it has to execute an external
program to check for suspend support. Today, to bypass the automatic reaper,
suspend code has to double fork and pass exit status information through a
pipe. Besides being complex, this is prone to race condition bugs. Indeed,
the current code does have such bugs.

Making the guest-suspend-* API synchronous (ie. by dropping the SIGCHLD
handler and calling waitpid() from commands) is a much simpler approach,
which fixes current race conditions bugs and enables commands to detect
errors in the child.

This commit does just that. There's a side effect though, guest-shutdown
will generate zombies if shutting down fails. This will be fixed by the
next commit.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-05-15 09:15:16 -05:00
..
channel-posix.c qemu-ga: Implement alternative to O_ASYNC 2012-05-01 10:49:23 +00:00
channel-win32.c qemu-ga: for w32, fix leaked handle ov.hEvent in ga_channel_write() 2012-03-19 11:31:04 +00:00
channel.h qemu-ga: move channel/transport functionality into wrapper class 2012-02-23 15:40:16 -06:00
commands-posix.c qemu-ga: guest-suspend: make the API synchronous 2012-05-15 09:15:16 -05:00
commands-win32.c qemu-ga: add guest-network-get-interfaces command 2012-03-12 15:09:18 -05:00
commands.c qemu-ga: add guest-sync-delimited 2012-03-12 15:09:23 -05:00
guest-agent-command-state.c Use glib memory allocation and free functions 2011-08-20 23:01:08 -05:00
guest-agent-core.h qemu-ga: make reopen_fd_to_null() public 2012-05-15 09:15:16 -05:00
service-win32.c qemu-ga: add Windows service integration 2012-02-23 15:43:50 -06:00
service-win32.h qemu-ga: add Windows service integration 2012-02-23 15:43:50 -06:00