httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject [patch mod_example.c] print pid, ppid and tid
Date Wed, 15 Oct 2003 23:58:21 GMT
As I was debugging some weird behavior of mod_perl 2, where getppid() was 
returning 1, I tried to verify that it works on the C level, using 
mod_example.c. Do you think it's worth adding the following in mod_example.c?

It prints something like:

Process ID: 31870, Parent Process ID: 31864, Thread ID: 16384

Index: modules/experimental/mod_example.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_example.c,v
retrieving revision 1.41.2.1
diff -u -r1.41.2.1 mod_example.c
--- modules/experimental/mod_example.c  3 Feb 2003 17:31:37 -0000       1.41.2.1
+++ modules/experimental/mod_example.c  15 Oct 2003 23:56:33 -0000
@@ -75,6 +75,11 @@
  #include "util_script.h"
  #include "http_connection.h"

+#if APR_HAVE_UNISTD_H
+/* for getpid() */
+#include <unistd.h>
+#endif
+
  #include "apr_strings.h"

  #include <stdio.h>
@@ -580,6 +585,12 @@
      ap_rputs("  <BR>\n", r);
      ap_rprintf(r, "  Server built: \"%s\"\n", ap_get_server_built());
      ap_rputs("  </P>\n", r);;
+    ap_rprintf(r, "<P>Process ID: %lu, Parent Process ID: %lu",
+               (unsigned long)getpid(), (unsigned long)getppid());
+#if APR_HAS_THREADS
+    ap_rprintf(r, ", Thread ID: %lu", (unsigned long)apr_os_thread_current());
+#endif
+    ap_rputs("  </P>\n", r);
      ap_rputs("  <P>\n", r);
      ap_rputs("  The format for the callback trace is:\n", r);
      ap_rputs("  </P>\n", r);

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Mime
View raw message