qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] catch signals


From: Gerd Hoffmann
Subject: Re: [Qemu-devel] [PATCH] catch signals
Date: Wed, 06 Aug 2008 11:20:39 +0200
User-agent: Thunderbird 2.0.0.14 (X11/20080501)

Daniel P. Berrange wrote:
> On Tue, Aug 05, 2008 at 06:09:39PM +0200, Gerd Hoffmann wrote:
>>  
>> +#ifndef _WIN32
>> +static void termsig_handler(int signal)
>> +{
>> +    switch (signal) {
>> +    case SIGSEGV:
>> +    case SIGBUS:
>> +        /* returning from signal handler most likely isn't going to work */
>> +        fprintf(stderr, "qemu: got signal %d (%s), taking emergency exit\n",
>> +                signal, strsignal(signal));
>> +        exit(1);
> 
> Neither of these functions are on the POSIX  async-signal-safe list,
> so their use from signal handlers is not a good idea.

We are in dead water already and also don't plan to ever return from the
 signal handler.  Is it really a problem then?

I want to be able to do cleanups (well, at least attempt) even in case
of a segfault.  If exit() + atexit handlers isn't going to fill the bill
we'll have to create some signal-save emergency cleanup handlers.

>> +        vm_start(); /* In case we're paused */
> 
> I think rather than trying todo anything in the signal handler,
> it is safest to just set a flag and have its state checked
> and acted upon in the main loop.

Isn't going to fly for SIGSEGV and SIGBUS.  Agree for the other signals.

I'll go check whenever we can handle stopped cpus some other way (guess
I just need an additional check in the main_loop() function).

cheers,
  Gerd

-- 
http://kraxel.fedorapeople.org/xenner/




reply via email to

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