Re: DPKG not compiling due to differences between Alpha and Intel...
David S. Miller writes ("Re: DPKG not compiling due to differences between Alpha and Intel..."):
> The layout of struct sigaction has become architecture dependant under
> Linux.
Oh dear.
> And yes it is mostly for binary compatability. Architectures
> like the sparc and the alpha do not need, and therefore do not have an
> sa_restorer member. Most of the time there is a special system call
> sys_sigreturn() which restores the necessary state from whatever is in
> the sigaction struct on the processes stack.
>
> The process is forced to call sys_sigreturn() via one of two mechanisms.
>
> 1) The code to call sys_sigreturn() with a pointer to the sigaction
> restoration information is placed on the users stack, to be
> executed when the signal handler function returns (this is the way
> the alpha does it, also it is how {net, open}bsd + solaris do it
> on the sparc).
Aha.
> 2) Libc manages where the real signal handers are and it points the
> kernel at one "signal trampoline" routine which does any extra
> state saving from user land for the process then calls the real
> signal handler via a signal function ptr table. After the
> trampoline code regains control is restores the extra state it
> saved before the signal handler call and calls sys_sigreturn() with
> the pointer to the sigaction struct as the first argument. This is
> how SunOS on the sparc and Linux on the sparc deal with things.
Right.
> This is why there exists no sa_restorer member. I hope this helps
> people out.
So, what am I supposed to do when I call sigaction ?
Supposing I want to set the action entirely myself, without using any
of the previous state (eg, by calling sigaction first to get the
current state and then modifying it). How do I fill in the sigaction
struct ?
Is it ever necessary to fill in the sa_restorer member, or will the
libc fill it in if it is needed/present ?
If the sa_restorer member is solely for the benefit of the libc, then
could this be made clearer in the manpage for sigaction ? My current
manpage says:
The sa_restorer element is obsolete and should not be
used.
This doesn't tell me whether it's safe to leave it undefined, or
whether I should fill it with NULL. I currently do the latter out of
paranoia.
Ian.
Reply to: