sigaction() function
Andrew Haley
aph@redhat.com
Wed Nov 18 10:56:00 GMT 2009
ranjith kumar wrote:
> I have one question about sigaction() function.
> Suppose in a program sigaction() is called to change the action taken
> by the process on receipt of a SIGTRAP signal.
> Let us say sigaction function is:
> void sig_sigaction(int, siginfo_t *, void *);
> When the program hits a trap at address=the contents of register
> REGPC(program counter),
> let us say the registers are REGPC,REG1,.........
>
> So when that trap is hit, KERNEL will modify the REGPC to point to
> starting address of 'sig_sigaction' function.
> But what about other registers and stack?? KERNEL may modify other
> registers and may write some thing on stack??
That's right. All the registers are saved in the siginfo_t struct
on the stack, and are restored when your sigaction() function
returns. But all this is a bit off-topic.
> Please ignore me if this question is not related to this group.
Why on earth did you cross-post to all these groups? This is
never going to be right.
Andrew.
More information about the Gcc-help
mailing list