chiark / gitweb /
journal: bump RLIMIT_NOFILE when journal files to 16K (if possible)
[elogind.git] / src / systemctl / systemctl.c
index a6c7e91f5422404dd976fd717f274a514b341c63..86b5ae0b039b4f61e1e80fa2a37430cc2915171d 100644 (file)
@@ -2966,7 +2966,7 @@ static int start_special(sd_bus *bus, char **args) {
              a == ACTION_HIBERNATE ||
              a == ACTION_HYBRID_SLEEP)) {
                 r = reboot_with_logind(bus, a);
-                if (r >= 0)
+                if (r >= 0 || IN_SET(r, -ENOTSUP, -EINPROGRESS))
                         return r;
         }
 
@@ -4515,11 +4515,7 @@ static int init_home_and_lookup_paths(char **user_home, char **user_runtime, Loo
                         return log_error_errno(ENOTDIR, "Cannot find units: $XDG_RUNTIME_DIR is not set.");
         }
 
-        r = lookup_paths_init(lp,
-                              arg_scope == UNIT_FILE_SYSTEM ? SYSTEMD_SYSTEM : SYSTEMD_USER,
-                              arg_scope == UNIT_FILE_USER,
-                              arg_root,
-                              NULL, NULL, NULL);
+        r = lookup_paths_init_from_scope(lp, arg_scope, arg_root);
         if (r < 0)
                 return log_error_errno(r, "Failed to lookup unit lookup paths: %m");
 
@@ -5188,8 +5184,10 @@ static int enable_sysv_units(const char *verb, char **args) {
                         return -EPROTO;
 
                 /* Remove this entry, so that we don't try enabling it as native unit */
-                assert(f > 0 && streq(args[f-1], name));
-                assert_se(strv_remove(args + f - 1, name));
+                assert(f > 0);
+                f--;
+                assert(args[f] == name);
+                strv_remove(args, name);
         }
 
 #endif
@@ -7411,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);