[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] qemu-ga: guest-shutdown: use only async-sign
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v2] qemu-ga: guest-shutdown: use only async-signal-safe functions |
Date: |
Mon, 14 May 2012 14:00:00 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 |
On 05/14/2012 12:25 PM, Luiz Capitulino wrote:
> POSIX mandates[1] that a child process of a multi-thread program uses
> only async-signal-safe functions before exec(). We consider qemu-ga
> to be multi-thread, because it uses glib.
>
> However, qmp_guest_shutdown() uses functions that are not
> async-signal-safe. Fix it the following way:
>
> - fclose() -> reopen_fd_to_null()
> - execl() -> execle()
> - exit() -> _exit()
> - drop slog() usage (which is not safe)
>
> [1] http://pubs.opengroup.org/onlinepubs/009695399/functions/fork.html
>
> Signed-off-by: Luiz Capitulino <address@hidden>
> ---
>
> o v2
>
> - fix doc typo
> - drop 'ret' and use EXIT_FAILURE instead
Not addressed was the 'environ' declaration issue, but I'm okay if you
save it for another day when we actually get a compile failure for using
an undeclared variable (since what you have _does_ work on glibc).
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake address@hidden +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature