blob: bbe8b325b5bebaf4c72ebb903968140af2810165 [file] [log] [blame]
Andrew Geissler9aee5002022-03-30 16:27:02 +00001From 5074ab3425e5f1e01fd9cfa2d9b7300ea1b3f38f Mon Sep 17 00:00:00 2001
Brad Bishopc342db32019-05-15 21:57:59 -04002From: Paul Eggleton <paul.eggleton@linux.intel.com>
3Date: Tue, 17 Jul 2012 11:27:39 +0100
Andrew Geissler9aee5002022-03-30 16:27:02 +00004Subject: [PATCH] apache2: bump up the core size limit if CoreDumpDirectory is
5 configured
Brad Bishopc342db32019-05-15 21:57:59 -04006
7Bump up the core size limit if CoreDumpDirectory is
8configured.
9
10Upstream-Status: Pending
11
12Note: upstreaming was discussed but there are competing desires;
13 there are portability oddities here too.
Brad Bishopc342db32019-05-15 21:57:59 -040014---
15 server/core.c | 19 +++++++++++++++++++
16 1 file changed, 19 insertions(+)
17
18diff --git a/server/core.c b/server/core.c
Andrew Geissler9aee5002022-03-30 16:27:02 +000019index 090e397..3020090 100644
Brad Bishopc342db32019-05-15 21:57:59 -040020--- a/server/core.c
21+++ b/server/core.c
Andrew Geissler9aee5002022-03-30 16:27:02 +000022@@ -5107,6 +5107,25 @@ static int core_post_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *pte
Brad Bishopc342db32019-05-15 21:57:59 -040023 }
24 apr_pool_cleanup_register(pconf, NULL, ap_mpm_end_gen_helper,
25 apr_pool_cleanup_null);
26+
27+#ifdef RLIMIT_CORE
28+ if (ap_coredumpdir_configured) {
29+ struct rlimit lim;
30+
31+ if (getrlimit(RLIMIT_CORE, &lim) == 0 && lim.rlim_cur == 0) {
32+ lim.rlim_cur = lim.rlim_max;
33+ if (setrlimit(RLIMIT_CORE, &lim) == 0) {
34+ ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL,
35+ "core dump file size limit raised to %lu bytes",
36+ lim.rlim_cur);
37+ } else {
38+ ap_log_error(APLOG_MARK, APLOG_NOTICE, errno, NULL,
39+ "core dump file size is zero, setrlimit failed");
40+ }
41+ }
42+ }
43+#endif
44+
45 return OK;
46 }
47
48--
Andrew Geissler9aee5002022-03-30 16:27:02 +0000492.25.1
Brad Bishopc342db32019-05-15 21:57:59 -040050