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

Re: siginfo_t structure is not filled in the signal handler



On Tue, Jul 06, 2004 at 04:25:03PM +0530, harishchandra.rao@wipro.com wrote:
> Hello,
> 
>  
> 
>        I am working on a Motorola VME 167 card with a 68040 processor.
> The card is running debian linux 2.2 (kernel 2.2.10). The application I
> am developing needs to handle signals and needs to know the cause of the
> signal. For example, if the application executes a divide by zero
> instruction then it should know in the signal handler if this was the
> cause.
> 
> For this the application checks the value of 'siginfo_t->si_code' passed
> to the signal handler. However, this value seems to always zero. 

Siginfo does not work at all for 2.2 kernels, 2.4 and later should
be fine. I am not sure if si_code is very meaningfull, signr which
is also available to the handler should be preferred where possible.
If you really need to use si_code you probably want to check kernel
source to make sure it does what you think
(me thinks arch/m68k/kernel/traps.c).

>    printf("D0 = %x\n", scp->uc_mcontext.gregs[R_D0]);

note that the definition of uc_mcontext in some versions
of glibc is incompatible to the def the kernel uses.
I have a workaround to get correct mcontext values if
you need it.

Richard



Reply to: