Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame^] | 1 | From 5074ab3425e5f1e01fd9cfa2d9b7300ea1b3f38f Mon Sep 17 00:00:00 2001 |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 2 | From: Paul Eggleton <paul.eggleton@linux.intel.com> |
| 3 | Date: Tue, 17 Jul 2012 11:27:39 +0100 |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame^] | 4 | Subject: [PATCH] apache2: bump up the core size limit if CoreDumpDirectory is |
| 5 | configured |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 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. |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 14 | --- |
| 15 | server/core.c | 19 +++++++++++++++++++ |
| 16 | 1 file changed, 19 insertions(+) |
| 17 | |
| 18 | diff --git a/server/core.c b/server/core.c |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame^] | 19 | index 090e397..3020090 100644 |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 20 | --- a/server/core.c |
| 21 | +++ b/server/core.c |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame^] | 22 | @@ -5107,6 +5107,25 @@ static int core_post_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *pte |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 23 | } |
| 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 Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame^] | 49 | 2.25.1 |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 50 | |