Re: Signal problem

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

 



On Thu, Sep 3, 2009 at 10:47 PM, Manish Katiyar<mkatiyar@xxxxxxxxx> wrote:
> On Fri, Sep 4, 2009 at 12:40 AM, vinit dhatrak<vinit.dhatrak@xxxxxxxxx> wrote:
>>
>>
>> On Fri, Sep 4, 2009 at 12:29 AM, Laurentziu Dascalu
>> <dascalu.laurentziu@xxxxxxxxx> wrote:
>>>
>>> 2009/9/3 Kent Tu <kachin2@xxxxxxxxx>:
>>> > Is this what you are looking for?
>>> > http://linux.die.net/man/2/signal
>>> >
>>> >
>>>
>>> No, I can't "intercept" SIGKILL with this. I still think there is some
>>> kind of hackish solution to this :-?
>
> How about having a parent process and then catching SIGCHLD ???
>

yes....i think this could be a solution.   create a parent before the
child, and catches (using waitid()) SIGCHLD when the child receive
exit.   but then u must also distinguish between graceful exit vs
being killed by SIGKILL/SIGSTOP etc.

alternatively a more complicated design is this:

create a piece of shared memory between parent and child.   every
state the child transitioned...it is updated into the shared mem.   so
one way is to (many possibilities exist...just an example) catch all
signal and then for each signal caught....change the state variable in
the shared mem.   so by deduction....if the child got killed, and the
state variable does not tally with the signal state last updated....it
can be deduced that SIGKILL OR SIGSTOP is received.

-- 
Regards,
Peter Teoh

--
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