Re: Signal problem

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

 



2009/9/3 Manish Katiyar <mkatiyar@xxxxxxxxx>:
> On Thu, Sep 3, 2009 at 11:52 PM, Laurentziu
> Dascalu<dascalu.laurentziu@xxxxxxxxx> wrote:
>> Hello,
>>
>> I want to "intercept" all possible signals in order to close all the
>> "states" of my application when a SIGKILL || SIGTERM || SEGFAULT ||
>> true arrives. I have some objects that flushes some data on their
>> destructor; all I want is to know how can I do this even if some other
>> application is killing me. I found *atexit()* but it doesn't work.
>
> Why isn't atexit() working ?? You can trap above signals like SIGTERM
> and call your handler to free, but one of the problem is that not all
> the signals are catchable and secondly things like SIGFAULT/SEGV even
> if you catch you don't know whether it is safe to run the program or
> not anymore so catching them is pretty much useless.

Let's focus on SIGKILL. man 7 signal says: "The signals SIGKILL and
SIGSTOP cannot be caught, blocked, or ignored.". I knew this before
the post, but I think there is a solution to the problem. Now I'm
thinking about writting a wrapper dummy application in a client-server
fashion; main applicatil will be the client, and the dummy the server.
When the server is killed (pipe broken) the client calls exit(0). The
problem is that, what I'm working on is a shared object for another
black box (well, it's free software but I'm not gonna debug their
code) application, not an application itself; I'm not sure it will
work.

> But if the objects are only allocated in memory won't they get
> automatically freed when program exits......is it something like
> shared semaphore/lock files etc. ?

Raw files on disk.

>>
>> The code is pretty simple:
>>
>> function()
>> {
>>    for-each object in objects_list
>>         delete object;
>> }
>>
>> That function _must_ be executed if the program started (e.g. main()
>> was called). Is there any way I can do this ? How can I do this ?
>>
>> Thanks,
>>
>> --
>> Laurențiu Dascălu
>>
>> --
>> To unsubscribe from this list: send an email with
>> "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
>> Please read the FAQ at http://kernelnewbies.org/FAQ
>>
>>
>
>
>
> --
> Thanks -
> Manish
>



-- 
Laurențiu Dascălu

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux