summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérôme Loyet <fat@php.net>2010-05-19 18:37:25 +0000
committerJérôme Loyet <fat@php.net>2010-05-19 18:37:25 +0000
commit962e95df5231c6f8ccb3ad5d4f3a1cf5a327e142 (patch)
treebdb0957193b988fe051e8d47f59033b617bd2e63
parentd3e1b1dbc35e35365216805d641df102a0340bd2 (diff)
downloadphp-git-962e95df5231c6f8ccb3ad5d4f3a1cf5a327e142.tar.gz
- set hard and soft limit (instead of only the soft limit) when setting rlimit_core or rlimit_files
- remove the debug log about getrlimit on the main process wich is meaningless when rlmit_* settings are set
-rw-r--r--sapi/fpm/fpm/fpm_unix.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/sapi/fpm/fpm/fpm_unix.c b/sapi/fpm/fpm/fpm_unix.c
index 0cec761167..395d703d18 100644
--- a/sapi/fpm/fpm/fpm_unix.c
+++ b/sapi/fpm/fpm/fpm_unix.c
@@ -150,21 +150,20 @@ int fpm_unix_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
if (wp->config->rlimit_files) {
struct rlimit r;
- getrlimit(RLIMIT_NOFILE, &r);
- r.rlim_cur = (rlim_t) wp->config->rlimit_files;
-// r.rlim_max = (rlim_t) wp->config->rlimit_files;
+ r.rlim_max = r.rlim_cur = (rlim_t) wp->config->rlimit_files;
+
if (0 > setrlimit(RLIMIT_NOFILE, &r)) {
- zlog(ZLOG_STUFF, ZLOG_SYSERROR, "[pool %s] setrlimit(RLIMIT_NOFILE) failed", wp->config->name);
+ zlog(ZLOG_STUFF, ZLOG_SYSERROR, "[pool %s] setrlimit(RLIMIT_NOFILE, %d) failed (%d)", wp->config->name, wp->config->rlimit_files, errno);
}
}
if (wp->config->rlimit_core) {
struct rlimit r;
- getrlimit(RLIMIT_CORE, &r);
- r.rlim_cur = wp->config->rlimit_core == -1 ? (rlim_t) RLIM_INFINITY : (rlim_t) wp->config->rlimit_core;
+ r.rlim_max = r.rlim_cur = wp->config->rlimit_core == -1 ? (rlim_t) RLIM_INFINITY : (rlim_t) wp->config->rlimit_core;
+
if (0 > setrlimit(RLIMIT_CORE, &r)) {
- zlog(ZLOG_STUFF, ZLOG_SYSERROR, "[pool %s] setrlimit(RLIMIT_CORE) failed", wp->config->name);
+ zlog(ZLOG_STUFF, ZLOG_SYSERROR, "[pool %s] setrlimit(RLIMIT_CORE, %d) failed (%d)", wp->config->name, wp->config->rlimit_core, errno);
}
}
@@ -248,14 +247,6 @@ int fpm_unix_init_main() /* {{{ */
}
fpm_stdio_init_final();
-
- {
- struct rlimit r;
- getrlimit(RLIMIT_NOFILE, &r);
-
- zlog(ZLOG_STUFF, ZLOG_NOTICE, "getrlimit(nofile): max:%lld, cur:%lld",
- (long long) r.rlim_max, (long long) r.rlim_cur);
- }
return 0;
}
/* }}} */