diff options
author | Yann Ylavic <ylavic@apache.org> | 2022-01-20 21:03:04 +0100 |
---|---|---|
committer | Yann Ylavic <ylavic@apache.org> | 2022-01-20 21:03:04 +0100 |
commit | af558302645384b998333f214d0af37cb3a4ff26 (patch) | |
tree | 77ce3fd86c87aeced8e800feb96c53a6ba3474f9 /modules/arch | |
parent | ap_regex: Follow up to r1897240: cleanups. (diff) | |
download | apache2-af558302645384b998333f214d0af37cb3a4ff26.tar.xz apache2-af558302645384b998333f214d0af37cb3a4ff26.zip |
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 <devnexen gmail.com>
Reviewed by: ylavic (by inspection)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897269 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/arch')
-rw-r--r-- | modules/arch/unix/mod_unixd.c | 16 |
1 files changed, 16 insertions, 0 deletions
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; } |