From de45d726034f33afdb0a185e62fc61bf10a0acd2 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 8 Jan 2015 03:17:50 +0100 Subject: journal: bump RLIMIT_NOFILE when journal files to 16K (if possible) When there are a lot of split out journal files, we might run out of fds quicker then we want. Hence: bump RLIMIT_NOFILE to 16K if possible. Do these even for journalctl. On Fedora the soft RLIMIT_NOFILE is at 1K, the hard at 4K by default for normal user processes, this code hence bumps this up for users to 4K. https://bugzilla.redhat.com/show_bug.cgi?id=1179980 --- src/journal/journalctl.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/journal') diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index 62931f14c9..db9576c493 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -1722,6 +1722,11 @@ int main(int argc, char *argv[]) { signal(SIGWINCH, columns_lines_cache_reset); sigbus_install(); + /* Increase max number of open files to 16K if we can, we + * might needs this when browsing journal files, which might + * be split up into many files. */ + setrlimit_closest(RLIMIT_NOFILE, &RLIMIT_MAKE_CONST(16384)); + if (arg_action == ACTION_NEW_ID128) { r = generate_new_id128(); goto finish; -- cgit v1.2.3-54-g00ecf