From af558302645384b998333f214d0af37cb3a4ff26 Mon Sep 17 00:00:00 2001 From: Yann Ylavic Date: Thu, 20 Jan 2022 20:03:04 +0000 Subject: mod_unixd: Make CoreDumpDirectory work for FreeBSD 11+. PR 65819. FreeBSD 11+ coredumping requires tracing enabled via procctl(PROC_TRACE_CTL). Submitted by: David CARLIER Reviewed by: ylavic (by inspection) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897269 13f79535-47bb-0310-9956-ffa450edef68 --- modules/arch/unix/mod_unixd.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'modules') 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 #endif +#ifdef HAVE_SYS_PROCCTL_H +#include +#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; } -- cgit v1.2.3