summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changes-entries/CoreDumpDirectory-freebsd11.txt2
-rw-r--r--configure.in2
-rw-r--r--docs/log-message-tags/next-number2
-rw-r--r--modules/arch/unix/mod_unixd.c16
4 files changed, 21 insertions, 1 deletions
diff --git a/changes-entries/CoreDumpDirectory-freebsd11.txt b/changes-entries/CoreDumpDirectory-freebsd11.txt
new file mode 100644
index 0000000000..e200f0cc02
--- /dev/null
+++ b/changes-entries/CoreDumpDirectory-freebsd11.txt
@@ -0,0 +1,2 @@
+ *) mod_unixd: CoreDumpDirectory requires enabling tracing on FreeBSD 11+.
+ PR 65819. [David CARLIER <devnexen gmail.com>]
diff --git a/configure.in b/configure.in
index 9ba3ad46e6..d049ae9253 100644
--- a/configure.in
+++ b/configure.in
@@ -476,6 +476,7 @@ pwd.h \
grp.h \
strings.h \
sys/prctl.h \
+sys/procctl.h \
sys/processor.h \
sys/sem.h \
sys/sdt.h \
@@ -533,6 +534,7 @@ getgrnam \
initgroups \
bindprocessor \
prctl \
+procctl \
timegm \
getpgid \
fopen64 \
diff --git a/docs/log-message-tags/next-number b/docs/log-message-tags/next-number
index 427e445179..daf369612b 100644
--- a/docs/log-message-tags/next-number
+++ b/docs/log-message-tags/next-number
@@ -1 +1 @@
-10369
+10370
diff --git a/modules/arch/unix/mod_unixd.c b/modules/arch/unix/mod_unixd.c
index 09343d368e..4ce279856f 100644
--- a/modules/arch/unix/mod_unixd.c
+++ b/modules/arch/unix/mod_unixd.c
@@ -50,6 +50,9 @@
#ifdef HAVE_SYS_PRCTL_H
#include <sys/prctl.h>
#endif
+#ifdef HAVE_SYS_PROCCTL_H
+#include <sys/procctl.h>
+#endif
#ifndef DEFAULT_USER
#define DEFAULT_USER "#-1"
@@ -201,6 +204,19 @@ AP_DECLARE(int) ap_unixd_setup_child(void)
}
}
#endif
+#if defined(HAVE_PROCCTL) && defined(PROC_TRACE_CTL)
+ /* FreeBSD 11 and above */
+ if (ap_coredumpdir_configured) {
+ int enablecoredump = PROC_TRACE_CTL_ENABLE;
+ if (procctl(P_PID, 0, PROC_TRACE_CTL, &enablecoredump) != 0) {
+ rv = errno;
+ ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, APLOGNO(10369)
+ "set dumpable failed - this child will not coredump"
+ " after software errors");
+ return rv;
+ }
+ }
+#endif
return OK;
}