httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject [PATCH] MONCONTROL
Date Sun, 11 Jan 1998 12:01:55 GMT
There's a comment near the top of the patch. 

Dean

Index: main/http_main.c
===================================================================
RCS file: /export/home/cvs/apachen/src/main/http_main.c,v
retrieving revision 1.263
diff -u -r1.263 http_main.c
--- http_main.c	1998/01/07 16:46:06	1.263
+++ http_main.c	1998/01/11 11:49:51
@@ -167,6 +167,20 @@
 
 DEF_Explain
 
+/* Defining GPROF when compiling uses the moncontrol() function to
+ * disable gprof profiling in the parent, and enable it only for
+ * request processing in children (or in one_process mode).  It's
+ * absolutely required to get useful gprof results under linux
+ * because the profile itimers and such are disabled across a
+ * fork().  It's probably useful elsewhere as well.
+ */
+#ifdef GPROF
+extern void moncontrol(int);
+#define MONCONTROL(x) moncontrol(x)
+#else
+#define MONCONTROL(x)
+#endif
+
 #ifndef MULTITHREAD
 /* this just need to be anything non-NULL */
 void *dummy_mutex = &dummy_mutex;
@@ -3181,6 +3195,7 @@
 
     if (!pid) {
 	RAISE_SIGSTOP(MAKE_CHILD);
+	MONCONTROL(1);
 	/* Disable the restart signal handlers and enable the just_die stuff.
 	 * Note that since restart() just notes that a restart has been
 	 * requested there's no race condition here.
@@ -3376,8 +3391,12 @@
     is_graceful = 0;
     ++generation;
 
-    if (!one_process)
+    if (!one_process) {
 	detach();
+    }
+    else {
+	MONCONTROL(1);
+    }
 
     my_pid = getpid();
 
@@ -3587,6 +3606,8 @@
 int main(int argc, char *argv[])
 {
     int c;
+
+    MONCONTROL(0);
 
 #ifdef AUX
     (void) set42sig();



Mime
View raw message