aboutsummaryrefslogtreecommitdiffstats
path: root/meta-webserver/recipes-httpd/apache2/apache2/0002-apache2-bump-up-the-core-size-limit-if-CoreDumpDirec.patch
blob: 85fe6ae4bd6d28aae4e61fc0c794756c408e0020 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From 7df207ad4d0dcda2ad36e5642296e0dec7e13647 Mon Sep 17 00:00:00 2001
From: Paul Eggleton <paul.eggleton@linux.intel.com>
Date: Tue, 17 Jul 2012 11:27:39 +0100
Subject: [PATCH] apache2: bump up the core size limit if CoreDumpDirectory
 is configured

Bump up the core size limit if CoreDumpDirectory is
configured.

Upstream-Status: Pending

Note: upstreaming was discussed but there are competing desires;
	there are portability oddities here too.

---
 server/core.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/server/core.c b/server/core.c
index eacb54f..7aa841f 100644
--- a/server/core.c
+++ b/server/core.c
@@ -4965,6 +4965,25 @@ static int core_post_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *pte
     }
     apr_pool_cleanup_register(pconf, NULL, ap_mpm_end_gen_helper,
                               apr_pool_cleanup_null);
+
+#ifdef RLIMIT_CORE
+    if (ap_coredumpdir_configured) {
+        struct rlimit lim;
+
+        if (getrlimit(RLIMIT_CORE, &lim) == 0 && lim.rlim_cur == 0) {
+            lim.rlim_cur = lim.rlim_max;
+            if (setrlimit(RLIMIT_CORE, &lim) == 0) {
+                ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL,
+                             "core dump file size limit raised to %lu bytes",
+                             lim.rlim_cur);
+            } else {
+                ap_log_error(APLOG_MARK, APLOG_NOTICE, errno, NULL,
+                             "core dump file size is zero, setrlimit failed");
+            }
+        }
+    }
+#endif
+
     return OK;
 }
 
-- 
2.7.4