[361] in Pthreads mailing list archive

home help back first fref pref prev next nref lref last post

suggested patch

daemon@ATHENA.MIT.EDU (Neal Becker)
Fri Jul 12 09:43:46 1996

From: Neal Becker <Neal.Becker@comsat.com>
To: pthreads@MIT.EDU
Date: Fri, 12 Jul 1996 08:16:33 -0400

I noticed that sig.c is mixing signal with sigaction.  On HPUX we are
warned not to do this.  I suggest this patch, although I can't verify
it actually helps anything in practice:

*** sig.c	1996/07/11 17:58:41	1.1
--- sig.c	1996/07/12 12:10:35
***************
*** 39,44 ****
--- 39,45 ----
  static const char rcsid[] = "sig.c,v 1.68.2.1 1996/03/13 04:33:13 proven Exp";
  #endif
  
+ #include <config.h>
  #include <errno.h>
  #include <pthread.h>
  #include <signal.h>
***************
*** 124,138 ****
  void pthread_sig_default(int sig)
  {
  	sigset_t mask, omask;
  
  	if (pthread_sigvec[sig].vector == SIG_DFL) {
  		/* Set the signal handler to default before issueing the kill */
! 		signal(sig, SIG_DFL);
  		kill(getpid(), sig);
  		sigemptyset(&mask);
  		sigaddset(&mask, sig);
  		machdep_sys_sigprocmask(SIG_UNBLOCK, &mask, &omask); 
  		signal(sig, sig_handler_real);
  	}
  }
  
--- 125,158 ----
  void pthread_sig_default(int sig)
  {
  	sigset_t mask, omask;
+ #if defined(HAVE_SYSCALL_SIGACTION) || defined(HAVE_SYSCALL_KSIGACTION)
+ 	struct sigaction act;
+ 
+ 	act.sa_handler = sig_handler_real;
+ 	sigemptyset(&(act.sa_mask));
+ 	act.sa_flags = 0;
+ #endif
  
  	if (pthread_sigvec[sig].vector == SIG_DFL) {
  		/* Set the signal handler to default before issueing the kill */
! #if defined(HAVE_SYSCALL_SIGACTION) || defined(HAVE_SYSCALL_KSIGACTION)
! 	  act.sa_handler = SIG_DFL;
! 	  sigaction (sig, &act, NULL);
! #else
! 	  signal(sig, SIG_DFL);
! #endif
! 
  		kill(getpid(), sig);
  		sigemptyset(&mask);
  		sigaddset(&mask, sig);
  		machdep_sys_sigprocmask(SIG_UNBLOCK, &mask, &omask); 
+ #if defined(HAVE_SYSCALL_SIGACTION) || defined(HAVE_SYSCALL_KSIGACTION)
+ 	  act.sa_handler = sig_handler_real;
+ 	  sigaction (sig, &act, NULL);
+ #else
  		signal(sig, sig_handler_real);
+ #endif
+ 
  	}
  }
  

home help back first fref pref prev next nref lref last post