qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 3/3] qtest: kill QEMU process on g_assert() fail


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH 3/3] qtest: kill QEMU process on g_assert() failure
Date: Mon, 17 Feb 2014 18:00:03 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

Paolo Bonzini <address@hidden> writes:

> Il 17/02/2014 16:44, Stefan Hajnoczi ha scritto:
>>  }
>>
>> +static void sigabrt_handler(int signo)
>> +{
>> +    qtest_end();
>> +}
>> +
>
> void qtest_quit(QTestState *s)
> {
>     int status;
>
>     if (s->qemu_pid != -1) {
>         kill(s->qemu_pid, SIGTERM);
>         waitpid(s->qemu_pid, &status, 0);
>     }
>
>     close(s->fd);
>     close(s->qmp_fd);
>     g_string_free(s->rx, true);
>     g_free(s);
> }
>
> Not async-signal safe.  You need to ignore the g_string_free and
> g_free (perhaps even the closes) if calling from the sigabrt_handler.

kill(), waitpid() and close() are all async-signal-safe.

SIGABRT is normally synchronous enough: it's sent by abort().  But of
course, nothing stops the user from kill -ABRT.  Or GLib from calling
abort() in some place where an attempt to reenter it crashes & burns.
Not sure I'd care, but I'm pretty sure I don't care for freeing stuff on
exit :)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]