tree-wide: uniformly bump RLIMIT_NOFILE in all our tools that access the journal
This makes use of rlimit_nofile_bump() in all tools that access the journal. In some cases this replaces older code to achieve this, and others we add it in where it was missing.
This commit is contained in:
parent
99ab6fdf8c
commit
1abaf4887d
|
@ -15,6 +15,7 @@
|
|||
#include "bus-error.h"
|
||||
#include "bus-util.h"
|
||||
#include "compress.h"
|
||||
#include "def.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
#include "fs-util.h"
|
||||
|
@ -26,6 +27,7 @@
|
|||
#include "parse-util.h"
|
||||
#include "path-util.h"
|
||||
#include "process-util.h"
|
||||
#include "rlimit-util.h"
|
||||
#include "sigbus.h"
|
||||
#include "signal-util.h"
|
||||
#include "string-util.h"
|
||||
|
@ -1067,6 +1069,9 @@ int main(int argc, char *argv[]) {
|
|||
log_parse_environment();
|
||||
log_open();
|
||||
|
||||
/* The journal merging logic potentially needs a lot of fds. */
|
||||
(void) rlimit_nofile_bump(HIGH_RLIMIT_NOFILE);
|
||||
|
||||
r = parse_argv(argc, argv);
|
||||
if (r <= 0)
|
||||
goto end;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "journal-remote-write.h"
|
||||
#include "journal-remote.h"
|
||||
#include "process-util.h"
|
||||
#include "rlimit-util.h"
|
||||
#include "signal-util.h"
|
||||
#include "socket-util.h"
|
||||
#include "stat-util.h"
|
||||
|
@ -1096,6 +1097,9 @@ int main(int argc, char **argv) {
|
|||
log_show_color(true);
|
||||
log_parse_environment();
|
||||
|
||||
/* The journal merging logic potentially needs a lot of fds. */
|
||||
(void) rlimit_nofile_bump(HIGH_RLIMIT_NOFILE);
|
||||
|
||||
r = parse_config();
|
||||
if (r < 0)
|
||||
return EXIT_FAILURE;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "mkdir.h"
|
||||
#include "parse-util.h"
|
||||
#include "process-util.h"
|
||||
#include "rlimit-util.h"
|
||||
#include "sigbus.h"
|
||||
#include "signal-util.h"
|
||||
#include "string-util.h"
|
||||
|
@ -780,6 +781,9 @@ int main(int argc, char **argv) {
|
|||
log_show_color(true);
|
||||
log_parse_environment();
|
||||
|
||||
/* The journal merging logic potentially needs a lot of fds. */
|
||||
(void) rlimit_nofile_bump(HIGH_RLIMIT_NOFILE);
|
||||
|
||||
r = parse_config();
|
||||
if (r < 0)
|
||||
goto finish;
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "bus-util.h"
|
||||
#include "catalog.h"
|
||||
#include "chattr-util.h"
|
||||
#include "def.h"
|
||||
#include "device-private.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
|
@ -2049,6 +2050,10 @@ int main(int argc, char *argv[]) {
|
|||
log_parse_environment();
|
||||
log_open();
|
||||
|
||||
/* Increase max number of open files if we can, we might needs this when browsing journal files, which might be
|
||||
* split up into many files. */
|
||||
(void) rlimit_nofile_bump(HIGH_RLIMIT_NOFILE);
|
||||
|
||||
r = parse_argv(argc, argv);
|
||||
if (r <= 0)
|
||||
goto finish;
|
||||
|
@ -2056,11 +2061,6 @@ 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));
|
||||
|
||||
switch (arg_action) {
|
||||
|
||||
case ACTION_NEW_ID128:
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "pager.h"
|
||||
#include "parse-util.h"
|
||||
#include "process-util.h"
|
||||
#include "rlimit-util.h"
|
||||
#include "sigbus.h"
|
||||
#include "signal-util.h"
|
||||
#include "spawn-polkit-agent.h"
|
||||
|
@ -1522,6 +1523,10 @@ int main(int argc, char *argv[]) {
|
|||
setlocale(LC_ALL, "");
|
||||
log_parse_environment();
|
||||
log_open();
|
||||
|
||||
/* The journal merging logic potentially needs a lot of fds. */
|
||||
(void) rlimit_nofile_bump(HIGH_RLIMIT_NOFILE);
|
||||
|
||||
sigbus_install();
|
||||
|
||||
r = parse_argv(argc, argv);
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "cgroup-show.h"
|
||||
#include "cgroup-util.h"
|
||||
#include "copy.h"
|
||||
#include "def.h"
|
||||
#include "env-util.h"
|
||||
#include "fd-util.h"
|
||||
#include "format-table.h"
|
||||
|
@ -37,6 +38,7 @@
|
|||
#include "path-util.h"
|
||||
#include "process-util.h"
|
||||
#include "ptyfwd.h"
|
||||
#include "rlimit-util.h"
|
||||
#include "sigbus.h"
|
||||
#include "signal-util.h"
|
||||
#include "spawn-polkit-agent.h"
|
||||
|
@ -3030,6 +3032,10 @@ int main(int argc, char*argv[]) {
|
|||
setlocale(LC_ALL, "");
|
||||
log_parse_environment();
|
||||
log_open();
|
||||
|
||||
/* The journal merging logic potentially needs a lot of fds. */
|
||||
(void) rlimit_nofile_bump(HIGH_RLIMIT_NOFILE);
|
||||
|
||||
sigbus_install();
|
||||
|
||||
r = parse_argv(argc, argv);
|
||||
|
|
|
@ -5264,12 +5264,6 @@ static int show(int argc, char *argv[], void *userdata) {
|
|||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
|
||||
if (show_mode == SYSTEMCTL_SHOW_STATUS)
|
||||
/* 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 no argument is specified inspect the manager itself */
|
||||
if (show_mode == SYSTEMCTL_SHOW_PROPERTIES && argc <= 1)
|
||||
return show_one(bus, "/org/freedesktop/systemd1", NULL, show_mode, &new_line, &ellipsized);
|
||||
|
@ -8661,6 +8655,10 @@ int main(int argc, char*argv[]) {
|
|||
setlocale(LC_ALL, "");
|
||||
log_parse_environment();
|
||||
log_open();
|
||||
|
||||
/* The journal merging logic potentially needs a lot of fds. */
|
||||
(void) rlimit_nofile_bump(HIGH_RLIMIT_NOFILE);
|
||||
|
||||
sigbus_install();
|
||||
|
||||
/* Explicitly not on_tty() to avoid setting cached value.
|
||||
|
|
Loading…
Reference in a new issue