httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Slemko <ma...@znep.com>
Subject [PATCH] sane coredumps
Date Sun, 10 Aug 1997 21:40:22 GMT
Lots of times our signal handlers for SEGV and BUS make it hard to get a
decent coredump from Apache.  To make it easier to get good core dumps out
of Apache, below is a patch that adds a define which disables the signal
handlers and lets you specify a directory that Apache chdirs() to in the
hopes of having a core dump live there.  Unfortunately, some modules play
with the cwd so you can't be sure of where it will end up dumping.  Still,
I find it a useful feature.

The use of the define should be documented somewhere, but I'm not sure
where....

Index: http_main.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_main.c,v
retrieving revision 1.198
diff -u -r1.198 http_main.c
--- http_main.c	1997/08/08 08:00:19	1.198
+++ http_main.c	1997/08/10 21:35:52
@@ -1551,12 +1551,14 @@
     sa.sa_flags = 0;
 
     if (!one_process) {
+#ifndef SANE_COREDIR
 	sa.sa_handler = seg_fault;
 	if (sigaction (SIGSEGV, &sa, NULL) < 0)
 	    log_unixerr ("sigaction(SIGSEGV)", NULL, NULL, server_conf);
 	sa.sa_handler = bus_error;
 	if (sigaction (SIGBUS, &sa, NULL) < 0)
 	    log_unixerr ("sigaction(SIGBUS)", NULL, NULL, server_conf);
+#endif
     }
     sa.sa_handler = sig_term;
     if (sigaction (SIGTERM, &sa, NULL) < 0)
@@ -1572,10 +1574,12 @@
 	log_unixerr ("sigaction(SIGUSR1)", NULL, NULL, server_conf);
 #else
     if(!one_process) {
+#ifndef SANE_COREDIR
 	signal (SIGSEGV, seg_fault);
 #ifdef SIGBUS
     	signal (SIGBUS, bus_error);
-#endif /* SIGBUS */
+#endif
+#endif /* SANE_COREDIR */
     }
 
     signal (SIGTERM, sig_term);
@@ -1598,7 +1602,11 @@
 #ifndef WIN32
     int x;
 
+#ifndef SANE_COREDIR
     chdir("/");
+#else
+    chdir(SANE_COREDIR);
+#endif
 #ifndef MPE
 /* Don't detach for MPE because child processes can't survive the death of
    the parent. */


Mime
View raw message