[513] in Zephyr_Bugs

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

zhm: Solaris signal handling code

daemon@ATHENA.MIT.EDU (epeisach@MIT.EDU)
Thu Jan 6 11:30:25 1994

From: epeisach@MIT.EDU
Date: Thu, 6 Jan 1994 11:30:17 -0500
To: bugs@MIT.EDU, bug-zephyr@MIT.EDU


I discovered this problem when porting zhm to another machine....
I needed the POSIX sigaction handling and noticed that when I compiled
with optimization, zhm was screwed (complaingin could not grow signal
stack, etc). Without optimization all was ok....

The problem was that the sa_flags was never set to something useful
(like 0) and probably had the SA_ONSTACK bit set causing problems...
If this has not been seen on solaris, then I am suprised. 

Has zhm ever died mysteriously on Solaris? If so, this patch is probably
required... 

*** 1.52	1993/07/26 08:29:36
--- zhm.c	1994/01/06 16:26:38
***************
*** 56,62 ****
--- 56,65 ----
  char *PidFile = PIDFILE;
  
  extern char *sbrk();
+ #ifndef POSIX
  extern long time();
+ #endif
+ 
  
  void init_hm(), detach(), handle_timeout(), resend_notices(), die_gracefully();
  
***************
*** 300,306 ****
       struct servent *sp;
       Code_t ret;
       FILE *fp;
! #ifdef SOLARIS
       struct sigaction sa;
  #endif
  
--- 303,309 ----
       struct servent *sp;
       Code_t ret;
       FILE *fp;
! #ifdef POSIX
       struct sigaction sa;
  #endif
  
***************
*** 398,406 ****
       send_boot_notice(HM_BOOT);
       deactivated = 0;
   
! #ifdef SOLARIS
  	sa.sa_handler = (void (*)()) set_sig_type;
  	sigemptyset(&sa.sa_mask);
  	sigaction(SIGHUP, &sa,0);
  	sigaction(SIGALRM, &sa, 0);
  	sigaction(SIGTERM, &sa,0);
--- 401,410 ----
       send_boot_notice(HM_BOOT);
       deactivated = 0;
   
! #if defined(POSIX)
  	sa.sa_handler = (void (*)()) set_sig_type;
  	sigemptyset(&sa.sa_mask);
+       sa.sa_flags = 0;
  	sigaction(SIGHUP, &sa,0);
  	sigaction(SIGALRM, &sa, 0);
  	sigaction(SIGTERM, &sa,0);


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