Re: [Qemu-devel] [PATCH] qemu-ga: guest-shutdown: use only async-signal-safe functions

2012-05-14 Thread Eric Blake
On 05/14/2012 01:59 PM, Luiz Capitulino wrote: I'll declare it then. >>> >>> -Wredundant-decls doesn't like it: >>> >>> /home/lcapitulino/work/src/qmp-unstable/qga/commands-posix.c:38:15: >>> warning: redundant redeclaration of ‘environ’ [-Wredundant-decls] >>> /usr/include/unistd.h:546:15: n

Re: [Qemu-devel] [PATCH] qemu-ga: guest-shutdown: use only async-signal-safe functions

2012-05-14 Thread Luiz Capitulino
On Mon, 14 May 2012 12:41:16 -0600 Eric Blake wrote: > On 05/14/2012 12:03 PM, Luiz Capitulino wrote: > > On Mon, 14 May 2012 15:01:17 -0300 > > Luiz Capitulino wrote: > > > + > +ret = execle("/sbin/shutdown", "shutdown", shutdown_flag, "+0", > +"hyper

Re: [Qemu-devel] [PATCH] qemu-ga: guest-shutdown: use only async-signal-safe functions

2012-05-14 Thread Eric Blake
On 05/14/2012 12:03 PM, Luiz Capitulino wrote: > On Mon, 14 May 2012 15:01:17 -0300 > Luiz Capitulino wrote: > + +ret = execle("/sbin/shutdown", "shutdown", shutdown_flag, "+0", +"hypervisor initiated shutdown", (char*)NULL, environ); >>> >>> Where

Re: [Qemu-devel] [PATCH] qemu-ga: guest-shutdown: use only async-signal-safe functions

2012-05-14 Thread Luiz Capitulino
On Mon, 14 May 2012 15:01:17 -0300 Luiz Capitulino wrote: > > > + > > > +ret = execle("/sbin/shutdown", "shutdown", shutdown_flag, "+0", > > > +"hypervisor initiated shutdown", (char*)NULL, > > > environ); > > > > Where was 'environ' declared? POSIX says that enviro

Re: [Qemu-devel] [PATCH] qemu-ga: guest-shutdown: use only async-signal-safe functions

2012-05-14 Thread Luiz Capitulino
On Mon, 14 May 2012 11:51:13 -0600 Eric Blake wrote: > On 05/14/2012 11:40 AM, 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. > >

Re: [Qemu-devel] [PATCH] qemu-ga: guest-shutdown: use only async-signal-safe functions

2012-05-14 Thread Eric Blake
On 05/14/2012 11:40 AM, 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 > a

[Qemu-devel] [PATCH] qemu-ga: guest-shutdown: use only async-signal-safe functions

2012-05-14 Thread Luiz Capitulino
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() ->