summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/journal/journalctl.c5
-rw-r--r--src/shared/util.h2
-rw-r--r--src/systemctl/systemctl.c5
3 files changed, 12 insertions, 0 deletions
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;
diff --git a/src/shared/util.h b/src/shared/util.h
index 31103e957f..3b3035a1c7 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -1074,3 +1074,5 @@ int same_fd(int a, int b);
int chattr_fd(int fd, bool b, int mask);
int chattr_path(const char *p, bool b, int mask);
+
+#define RLIMIT_MAKE_CONST(lim) ((struct rlimit) { lim, lim })
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 679541493a..86b5ae0b03 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -7409,6 +7409,11 @@ int main(int argc, char*argv[]) {
goto finish;
}
+ /* 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 (!avoid_bus())
r = bus_open_transport_systemd(arg_transport, arg_host, arg_scope != UNIT_FILE_SYSTEM, &bus);