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

Re: DPKG not compiling due to differences between Alpha and Intel...



   Date: 	Tue, 23 Jan 96 23:02 GMT
   From: Ian Jackson <ian@chiark.chu.cam.ac.uk>

   > * Structure sigaction has no member sa_restorer.

   Huh ?  This really confuses me.  Is this necessary for OSF/1
   compatibility ?  How am I to write code that works right on both
   systems, if I refuse to use #ifdef ?

   (Obviously I shouldn't need to use #ifdef to compile
   architecture-independent code on different Linux systems !)

The layout of struct sigaction has become architecture dependant under
Linux.  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).

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.

This is why there exists no sa_restorer member.  I hope this helps
people out.

Later,
David S. Miller
davem@caip.rutgers.edu


Reply to: