|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
From 8bdb345984f8a00ff866c1b4198888a9eef03395 Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
Date: Tue, 14 Apr 2015 20:47:20 -0500
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
Subject: [PATCH] systemctl: avoid bumping NOFILE rlimit unless needed
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
We actually only use the journal when showing status. Move setrlimit call
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
so it is only called for status.
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
https://bugzilla.redhat.com/show_bug.cgi?id=1184712
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
(cherry picked from commit 40acc203c043fd419f3c045dc6f116c3a28411d8)
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
src/systemctl/systemctl.c | 11 ++++++-----
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
1 file changed, 6 insertions(+), 5 deletions(-)
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
index 4ec0cff21d..089c25f83f 100644
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
--- a/src/systemctl/systemctl.c
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
+++ b/src/systemctl/systemctl.c
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
@@ -4449,6 +4449,12 @@ static int show(sd_bus *bus, char **args) {
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
if (show_properties)
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
pager_open_if_enabled();
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
+ if (show_status)
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
+ /* Increase max number of open files to 16K if we can, we
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
+ * might needs this when browsing journal files, which might
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
+ * be split up into many files. */
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
+ setrlimit_closest(RLIMIT_NOFILE, &RLIMIT_MAKE_CONST(16384));
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
/* If no argument is specified inspect the manager itself */
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
if (show_properties && strv_length(args) <= 1)
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
@@ -7207,11 +7213,6 @@ found:
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
- /* Increase max number of open files to 16K if we can, we
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
- * might needs this when browsing journal files, which might
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
- * be split up into many files. */
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
- setrlimit_closest(RLIMIT_NOFILE, &RLIMIT_MAKE_CONST(16384));
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
-
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
return verb->dispatch(bus, argv + optind);
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
ef7b48 |
|