Subject: Re: signal stuff...
To: Ignatios Souvatzis <ignatios@cs.uni-bonn.de>
From: Brian Baird <brb@brig.com>
List: tech-kern
Date: 01/08/1999 03:24:44
Although sigaction's man page doesn't mention it, having an undefined
bit on in sa_flags will cause an EINVAL.

The program certainly shouldn't assume that the "struct sigaction act"
defined on the stack is initialized to zero.  The setting of sa_flags
should use =, not |=, and there should be a call to sigemptyset(&act.sa_mask)
before calling sigaction.

> int   
> chkpt_init(filename)
> char *filename;
> {
>   int pagesize;
>   struct sigaction act;
>   ...
>   act.sa_handler = (void (*)(int)) &chkpt_restore;
>   act.sa_flags |= SA_ONSTACK;
>   if (sigaction(SIGUSR1, &act, (struct sigaction *) NULL) == 0) {
>  } else {
> #if defined(IAGNOSTIC)
>     debug("chkpt_init(): error: Installation of handler SIGUSR1 failed.\n");
> #endif
>     return E_CHKPT_SYS;
>   }

--Brian;