paul@athertn.Atherton.COM (Paul Sander) (01/31/91)
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. Has anyone else run into this problem, and is there a workaround other than using signal(3)? Is this to be fixed in v2.0.1? -- Paul Sander (408) 734-9822 | "Passwords are like underwear," she said, paul@Atherton.COM | "Both should be changed often." {decwrl,pyramid,sun}!athertn!paul | -- Bennett Falk in "Mom Meets Unix"
ksand@Apple.COM (Kent Sandvik) (02/09/91)
In article <34162@athertn.Atherton.COM> paul@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@apple.com, AppleLink: KSAND DISCLAIMER: Private mumbo-jumbo Zippy++ says: "Read my lips, no more C++ syntax..."