Skip to content

Commit b759ee1

Browse files
ylavicnotroj
authored andcommitted
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 (cherry picked from commit af55830)
1 parent 08cc879 commit b759ee1

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*) mod_unixd: CoreDumpDirectory requires enabling tracing on FreeBSD 11+.
2+
PR 65819. [David CARLIER <devnexen gmail.com>]

configure.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ pwd.h \
463463
grp.h \
464464
strings.h \
465465
sys/prctl.h \
466+
sys/procctl.h \
466467
sys/processor.h \
467468
sys/sem.h \
468469
sys/sdt.h \
@@ -520,6 +521,7 @@ getgrnam \
520521
initgroups \
521522
bindprocessor \
522523
prctl \
524+
procctl \
523525
timegm \
524526
getpgid \
525527
fopen64 \

modules/arch/unix/mod_unixd.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050
#ifdef HAVE_SYS_PRCTL_H
5151
#include <sys/prctl.h>
5252
#endif
53+
#ifdef HAVE_SYS_PROCCTL_H
54+
#include <sys/procctl.h>
55+
#endif
5356

5457
#ifndef DEFAULT_USER
5558
#define DEFAULT_USER "#-1"
@@ -201,6 +204,19 @@ AP_DECLARE(int) ap_unixd_setup_child(void)
201204
}
202205
}
203206
#endif
207+
#if defined(HAVE_PROCCTL) && defined(PROC_TRACE_CTL)
208+
/* FreeBSD 11 and above */
209+
if (ap_coredumpdir_configured) {
210+
int enablecoredump = PROC_TRACE_CTL_ENABLE;
211+
if (procctl(P_PID, 0, PROC_TRACE_CTL, &enablecoredump) != 0) {
212+
rv = errno;
213+
ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, APLOGNO(10369)
214+
"set dumpable failed - this child will not coredump"
215+
" after software errors");
216+
return rv;
217+
}
218+
}
219+
#endif
204220

205221
return OK;
206222
}

0 commit comments

Comments
 (0)