Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame^] | 1 | |
| 2 | Bump up the core size limit if CoreDumpDirectory is |
| 3 | configured. |
| 4 | |
| 5 | Upstream-Status: Pending |
| 6 | |
| 7 | Note: upstreaming was discussed but there are competing desires; |
| 8 | there are portability oddities here too. |
| 9 | |
| 10 | --- httpd-2.4.1/server/core.c.corelimit |
| 11 | +++ httpd-2.4.1/server/core.c |
| 12 | @@ -4433,6 +4433,25 @@ static int core_post_config(apr_pool_t * |
| 13 | } |
| 14 | apr_pool_cleanup_register(pconf, NULL, ap_mpm_end_gen_helper, |
| 15 | apr_pool_cleanup_null); |
| 16 | + |
| 17 | +#ifdef RLIMIT_CORE |
| 18 | + if (ap_coredumpdir_configured) { |
| 19 | + struct rlimit lim; |
| 20 | + |
| 21 | + if (getrlimit(RLIMIT_CORE, &lim) == 0 && lim.rlim_cur == 0) { |
| 22 | + lim.rlim_cur = lim.rlim_max; |
| 23 | + if (setrlimit(RLIMIT_CORE, &lim) == 0) { |
| 24 | + ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL, |
| 25 | + "core dump file size limit raised to %lu bytes", |
| 26 | + lim.rlim_cur); |
| 27 | + } else { |
| 28 | + ap_log_error(APLOG_MARK, APLOG_NOTICE, errno, NULL, |
| 29 | + "core dump file size is zero, setrlimit failed"); |
| 30 | + } |
| 31 | + } |
| 32 | + } |
| 33 | +#endif |
| 34 | + |
| 35 | return OK; |
| 36 | } |
| 37 | |