AUX, signal, and sigvec

Darrell Schiebel schiebel at cs.wvu.wvnet.edu
Fri May 3 23:04:34 AEST 1991


I am tring to get signal trapping working on some code I'm porting to AUX.
Here is the code I'm using (the entire code is at the end of message):

	svec.sv_flags = 0;
	svec.sv_mask = 0xffffff;
	svec.sv_handler = catcher;
	if (sigvec(2,&svec,0) == -1){

Where "catcher" is the signal handler. I`ve tried other things for the
"sv_mask",0 and 2. Does the mask indicate signals which get passed to
handlers or signals which do not get passed? At any rate, the above code 
works when compiled on Suns but not when compiled on A/UX. I get the error 
invalid argument when I make the call to sigvec. Any suggestions?

The "signal" works both on Sun and A/UX (attesting to its portablility). So 
why not use signal? In the A/UX man pages it sayes that the only thing passed
to the signal handler is the signal id. I need to have more information than
this, i.e. the information provided by "sigvec":

	ghandle (sig, code, scp)
	  int sig, code;
	  struct sigcontext *scp;

I'd appreciate any information anyone could provide. Also on the Sun, using
signal instead of sigvec, the handler gets called with each signal sent with
"kill", but under A/UX the process dies with the second signal. Do I need to
reset something. Suns are very forgiving.


						Many Thanks,
						Darrell Schiebel
						(schiebel at a.cs.wvu.wvnet.edu)
						(drs at baks.bell-atl.com)


--X--X--X--X--X--X--X--X--X--X--X--X--X--X--X--X--X--
#include <signal.h>
#include <errno.h>
#include <stdio.h>

int catcher(){
  printf("in catcher\n");}

main(){
  struct sigvec svec;

  svec.sv_flags = 0;
  svec.sv_mask = 0xffffff;
  svec.sv_handler = catcher;

/*  signal(2,catcher);*/
  if (sigvec(2,&svec,0) == -1){
    perror("main");
    switch(errno){
      case EFAULT:
        printf("EFAULT\n");
        break;
      case EINVAL:
        printf("EINVAL\n");
        break;}
    exit(1);}
  while (! feof(stdin));}



More information about the Comp.unix.aux mailing list