Subject: signal stuff...
To: None <tech-kern@netbsd.org>
From: Ignatios Souvatzis <ignatios@cs.uni-bonn.de>
List: tech-kern
Date: 01/08/1999 11:53:08
Hi,

when trying the chkpt package on two -current systems (arm32 and i386),
I noticed this (ktrace from i386):

  8671 test1_chkpt CALL  __sigaltstack14(0xefbfd59c,0)
  8671 test1_chkpt RET   __sigaltstack14 0
  8671 test1_chkpt CALL  __sigaction14(0x1e,0xefbfd5ec,0)
  8671 test1_chkpt RET   __sigaction14 -1 errno 22 Invalid argument

The corresponding source code snippets (from
pkgsrc/devel/chkpt/work/chkpt-1.6.1/chkpt/chkpt.c) are:

...
#include <signal.h>
...
int   
chkpt_init(filename)
char *filename;
{
  int pagesize;
  struct sigaction act;
  ...
  struct sigaltstack sigstack;
...
/* Now that we have set the program brk, we can sbrk() space for the signal
 * stack (here) and for the save structure (further down). */
  sigstack.ss_sp = sbrk(SIGSTACKSIZE);
  if (sigstack.ss_sp == (char *) -1) {
    return E_CHKPT_NOMEM;
  } 
  sigstack.ss_size = SIGSTACKSIZE;
  sigstack.ss_flags = 0;
  if (sigaltstack(&sigstack, 0) < 0) {
    return E_CHKPT_SYS;
  }   
  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;
  }
...


What is wrong here? Any include missing?
	-is