[aus.sun-works] Using a signal stack on a Sun 4/110

jamesp@wacsvax.OZ (James Pinakis) (12/29/89)

I'm having trouble arranging for a signal to be taken on a separate
signal stack on a Sun 4.  The attached program works on a VAX running
4.3BSD and a Sun 3/60 running SunOS 4.0.3 but dies when I try to run
it on a Sun 4/110 also running SunOS 4.0.3.  The program dumps core
the first time the signal is delivered, with an "Illegal Instruction"
message.  If I change the line marked "this line" to read
    sv.sv_flags = 0;
the program works ok, but I desperately want a separate signal stack.

Has anyone else encountered/fixed this problem?

#include <sys/types.h>
#include <signal.h>
#include <sys/time.h>

#define stack_size  5000

struct itimerval    it;
struct sigstack     sgstck;
struct sigvec       sv;
int                 signal_stack[stack_size];

void hello() {

main() {
    sgstck.ss_sp = (caddr_t) &signal_stack[stack_size-1];
    sgstck.ss_onstack = 0;
    if(sigstack(&sgstck,0) < 0) {
    sv.sv_handler = hello;
    sv.sv_mask = sigmask(SIGVTALRM);
    sv.sv_flags = SV_ONSTACK;             /* this line */
    sigvec(SIGVTALRM, &sv, 0);

    it.it_interval.tv_sec = 2; it.it_interval.tv_usec = 0;
    it.it_value.tv_sec = 2; it.it_value.tv_usec = 0;

    for(;;) ;