Subject: Incorrect sigcontext when signal handler called??
To: None <port-macppc@netbsd.org>
From: Sanjay Lal <sanjayl@iqmail.net>
List: port-macppc
Date: 04/03/2000 01:19:13
I am running NetBSD 1.4.1 for the mac/ppc. There might be a bug here, I
am not sure.
The sigconext parameter (scp) passed
as parameter 3 to the signal handler might be incorrect. Any access to
this space,
(copying it, printing etc) hangs the process completely.
Has anyone else seen this or am I doing something completely wrong here?

Any help would be greatly appreciated.

Thanks in advance,

Sanjay
sanjayl@iqmail.net


The small program below reproduces it:
#include <stdio.h>
#include <signal.h>

void
sig_handler (int sig, int code, struct sigcontext * scp);

int main (void)
{
        struct sigaction act;

        /* Initialise the global signal action structure: */
        sigfillset(&act.sa_mask);
        act.sa_handler = (void (*) ()) sig_handler;
        act.sa_flags = 0;

        if (sigaction (SIGINT, &act, NULL) != 0)
                printf("sigaction failed\n");


        sleep(100);
}

void
sig_handler (int sig, int code, struct sigcontext * scp)
{
        printf("sig: %d\tcode: %d\tscp: 0x%X\n", sig, code, scp);
        printf("scp.sc_frame[r1]: 0x%X\n", scp->sc_frame.fixreg[1]);
}