You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jim Jagielski <ji...@jaguNET.com> on 1996/05/11 18:31:23 UTC

SIGACTION patch

Here's a sigaction patch that should patch cleanly against the current
CVS tree. I added a compile define in case some systems don't have or need
to use sigaction() over signal():
? apache/src/a.patch
Index: apache/src/http_main.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_main.c,v
retrieving revision 1.25
diff -c -r1.25 http_main.c
*** http_main.c	1996/05/07 18:29:34	1.25
--- http_main.c	1996/05/11 16:26:38
***************
*** 963,975 ****
  }
  
  void set_signals() {
! 	if(!one_process)
! 	{
! 	    signal(SIGSEGV,(void (*)())seg_fault);
      	signal(SIGBUS,(void (*)())bus_error);
! 	}
      signal(SIGTERM,(void (*)())sig_term);
      signal(SIGHUP,(void (*)())restart);
  }
  
  /*****************************************************************
--- 963,987 ----
  }
  
  void set_signals() {
! #ifndef NO_USE_SIGACTION
!     struct sigaction sa;
! #endif
!     if(!one_process) {
! 	signal(SIGSEGV,(void (*)())seg_fault);
      	signal(SIGBUS,(void (*)())bus_error);
!     }
! #ifdef NO_USE_SIGACTION
      signal(SIGTERM,(void (*)())sig_term);
      signal(SIGHUP,(void (*)())restart);
+ #else
+     memset(&sa,0,sizeof sa);
+     sa.sa_handler=(void (*)())sig_term;
+     if(sigaction(SIGTERM,&sa,NULL) < 0)
+ 	log_unixerr("sigaction(SIGTERM)", NULL, NULL, server_conf);
+     sa.sa_handler=(void (*)())restart;
+     if(sigaction(SIGHUP,&sa,NULL) < 0)
+ 	log_unixerr("sigaction(SIGHUP)", NULL, NULL, server_conf);
+ #endif
  }
  
  /*****************************************************************
-- 
Jim Jagielski  << jim@jaguNET.com >>   |      "That's a Smith & Wesson,
  **  jaguNET Access Services  **      |       and you've had your six" 
      Email: info@jaguNET.com          |             - James Bond
++    http://www.jaguNET.com/         +++      Voice/Fax: 410-931-3157       ++