Sigvec bug?

Kent Sandvik ksand at Apple.COM
Sat Feb 9 08:48:46 AEST 1991


In article <34162 at athertn.Atherton.COM> paul at Atherton.COM (Paul Sander) writes:
>I've been working on a program that uses a signal handler, and I find that
>sigvec(2) seems to always return -1, with errno set to EINVAL.  I've been
>trying to set a signal handler for SIGPIPE, which is a valid signal number
>according to the man pages.  I'm also passing the addresses of the
>appropriate structures.

Here's a code example I'm using for some other signal testing just now,
using BSD signal handlers with A/UX. Maybe it helps you in your case.

#include <compat.h>
#include <stdio.h>
#include <signal.h>
#include <sys/time.h>


void myCatcher(sig, code, scp)
int sig;
int code;
int *scp;
{
        fprintf(stderr,"Signal %d received, code %d\n", sig, code);
        return;
}

void main()
{
        int i, j, k;
        struct sigvec vec;
        struct itimerval tim;

        setcompat(COMPAT_BSDSIGNALS);

        fprintf(stderr,"Start\n");

        vec.sv_handler = &myCatcher;
        vec.sv_mask = 0;
        vec.sv_flags = 0;

        sigvec(SIGILL,&vec,NULL);
        sigvec(SIGFPE,&vec,NULL);
        sigvec(SIGALRM,&vec,NULL);

        gettimeofday(tim.it_value, NULL);
        tim.it_interval.tv_sec = 0;
        tim.it_interval.tv_usec = 0;
        tim.it_value.tv_sec + = 10;


        setitimer(ITIMER_REAL,&tim,NULL);

        for(i = 1; i++; 1 < 0x4000) {
                for(j = 1; j++; j < 0x4000)
                        k = k-k;
        }
}

Regards,
Kent Sandvik (assuming that there's 100 bugs in this quick hack...)

-- 
Kent Sandvik, Apple Computer Inc, Developer Technical Support
NET:ksand at apple.com, AppleLink: KSAND  DISCLAIMER: Private mumbo-jumbo
Zippy++ says: "Read my lips, no more C++ syntax..."



More information about the Comp.unix.aux mailing list