qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCHv3] report that QEMU process was killed by a sign


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCHv3] report that QEMU process was killed by a signal
Date: Wed, 30 Mar 2011 19:53:41 +0100

On 30 March 2011 19:43, Gleb Natapov <address@hidden> wrote:
> On Wed, Mar 30, 2011 at 07:39:31PM +0100, Peter Maydell wrote:
>> Unfortunately this patch causes qemu to segfault when killed
>> via ^C (at least on my Ubuntu maverick system). This is because
>> it registers a signal handler with sigaction, but then later
>> the SDL library is initialised and it reinstalls our handler
>> with plain old signal:
>>
>>         ohandler = signal(SIGINT, SDL_HandleSIG);
>>         if ( ohandler != SIG_DFL )
>>                 signal(SIGINT, ohandler);
>>
> I fixed this in SDL upstream.

Cool, but we can't rely on the SDL we're linked against being
a bugfixed version.

>> This is clearly buggy but on the other hand SDL is pretty widely
>> deployed and it's the default QEMU video output method, so I think
>> we need to work around it :-(
>>
>> The most straightforward fix is to get the signal number from
>> argument one and not to bother printing the PID that killed us.
>>
> For debugging purposes pid is useful. We cam register signal handler
> after SDL is initialized though (if waiting for SDL update is not an
> option).

I'm not convinced about the utility of printing the pid, personally.
Most programs get along fine without printing anything when
they receive a terminal signal. However you're right that it should
be straightforward enough to move the signal init. In fact it
looks like this got broken somewhere along the line, the
call to os_setup_signal_handling() is already preceded with a comment:

    /* must be after terminal init, SDL library changes signal handlers */
    os_setup_signal_handling();

...we just aren't actually after the terminal init any more :-(

-- PMM



reply via email to

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