Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 1 | From 7df207ad4d0dcda2ad36e5642296e0dec7e13647 Mon Sep 17 00:00:00 2001 |
| 2 | From: Paul Eggleton <paul.eggleton@linux.intel.com> |
| 3 | Date: Tue, 17 Jul 2012 11:27:39 +0100 |
| 4 | Subject: [PATCH] apache2: bump up the core size limit if CoreDumpDirectory |
| 5 | is configured |
| 6 | |
| 7 | Bump up the core size limit if CoreDumpDirectory is |
| 8 | configured. |
| 9 | |
| 10 | Upstream-Status: Pending |
| 11 | |
| 12 | Note: upstreaming was discussed but there are competing desires; |
| 13 | there are portability oddities here too. |
| 14 | |
| 15 | --- |
| 16 | server/core.c | 19 +++++++++++++++++++ |
| 17 | 1 file changed, 19 insertions(+) |
| 18 | |
| 19 | diff --git a/server/core.c b/server/core.c |
| 20 | index eacb54f..7aa841f 100644 |
| 21 | --- a/server/core.c |
| 22 | +++ b/server/core.c |
| 23 | @@ -4965,6 +4965,25 @@ static int core_post_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *pte |
| 24 | } |
| 25 | apr_pool_cleanup_register(pconf, NULL, ap_mpm_end_gen_helper, |
| 26 | apr_pool_cleanup_null); |
| 27 | + |
| 28 | +#ifdef RLIMIT_CORE |
| 29 | + if (ap_coredumpdir_configured) { |
| 30 | + struct rlimit lim; |
| 31 | + |
| 32 | + if (getrlimit(RLIMIT_CORE, &lim) == 0 && lim.rlim_cur == 0) { |
| 33 | + lim.rlim_cur = lim.rlim_max; |
| 34 | + if (setrlimit(RLIMIT_CORE, &lim) == 0) { |
| 35 | + ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL, |
| 36 | + "core dump file size limit raised to %lu bytes", |
| 37 | + lim.rlim_cur); |
| 38 | + } else { |
| 39 | + ap_log_error(APLOG_MARK, APLOG_NOTICE, errno, NULL, |
| 40 | + "core dump file size is zero, setrlimit failed"); |
| 41 | + } |
| 42 | + } |
| 43 | + } |
| 44 | +#endif |
| 45 | + |
| 46 | return OK; |
| 47 | } |
| 48 | |
| 49 | -- |
| 50 | 2.7.4 |
| 51 | |