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