a71a57
a71a57
Enable core dumps.  In upstream 3.x branch:
a71a57
a71a57
http://code.google.com/p/modwsgi/source/detail?r=b4f55d756fa816a7eae0f7edc13d5f2da3f3d5c1&name=mod_wsgi-3.X&path=/mod_wsgi.c#
a71a57
a71a57
--- mod_wsgi-3.4/configure.ac.dumpcore
a71a57
+++ mod_wsgi-3.4/configure.ac
a71a57
@@ -39,6 +39,8 @@ fi
a71a57
 
a71a57
 AC_SUBST(APXS)
a71a57
 
a71a57
+AC_CHECK_FUNCS(prctl)
a71a57
+
a71a57
 AC_MSG_CHECKING(Apache version)
a71a57
 HTTPD="`${APXS} -q SBINDIR`/`${APXS} -q TARGET`"
a71a57
 HTTPD_INCLUDEDIR="`${APXS} -q INCLUDEDIR`"
a71a57
--- mod_wsgi-3.4/mod_wsgi.c.coredump
a71a57
+++ mod_wsgi-3.4/mod_wsgi.c
a71a57
@@ -139,6 +139,10 @@ typedef regmatch_t ap_regmatch_t;
a71a57
 #include <pwd.h>
a71a57
 #endif
a71a57
 
a71a57
+#ifdef HAVE_SYS_PRCTL_H
a71a57
+#include <sys/prctl.h>
a71a57
+#endif
a71a57
+
a71a57
 #include "Python.h"
a71a57
 
a71a57
 #if !defined(PY_VERSION_HEX)
a71a57
@@ -10485,6 +10489,17 @@ static void wsgi_setup_access(WSGIDaemon
a71a57
                      "mod_wsgi (pid=%d): Unable to change to uid=%ld.",
a71a57
                      getpid(), (long)daemon->group->uid);
a71a57
     }
a71a57
+
a71a57
+#if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE)
a71a57
+    /* this applies to Linux 2.4+ */
a71a57
+    if (ap_coredumpdir_configured) {
a71a57
+        if (prctl(PR_SET_DUMPABLE, 1)) {
a71a57
+            ap_log_error(APLOG_MARK, WSGI_LOG_ALERT(errno), wsgi_server,
a71a57
+                         "mod_wsgi (pid=%d): set dumpable failed - this child will not coredump"
a71a57
+                         " after software errors", getpid());
a71a57
+        }
a71a57
+    }
a71a57
+#endif
a71a57
 }
a71a57
 
a71a57
 static int wsgi_setup_socket(WSGIProcessGroup *process)