#include "def.h"
#include "dirent-util.h"
#include "fd-util.h"
-#include "formats-util.h"
+#include "format-util.h"
#include "logind.h"
#include "selinux-util.h"
#include "signal-util.h"
#include "strv.h"
#include "udev-util.h"
-
/// Additional includes needed by elogind
#include "cgroup.h" // From src/core/
#include "elogind.h"
static void manager_free(Manager *m);
static void manager_reset_config(Manager *m) {
-
#if 0 /// elogind does not support autospawning of vts
m->n_autovts = 6;
m->reserve_vt = 6;
m->idle_action = HANDLE_IGNORE;
m->runtime_dir_size = physical_memory_scale(10U, 100U); /* 10% */
- m->user_tasks_max = system_tasks_max_scale(33U, 100U); /* 33% */
+ m->user_tasks_max = system_tasks_max_scale(DEFAULT_USER_TASKS_MAX_PERCENTAGE, 100U); /* 33% */
m->sessions_max = 8192;
m->inhibitors_max = 8192;
m->kill_only_users = strv_free(m->kill_only_users);
m->kill_exclude_users = strv_free(m->kill_exclude_users);
-
#if 1 /// elogind needs an Add-On for sleep configuration
elogind_manager_reset_config(m);
#endif // 1
if (r < 0)
goto fail;
#endif // 1
-
m->udev = udev_new();
if (!m->udev)
goto fail;
Inhibitor *i;
Button *b;
- assert(m);
+ if (!m)
+ return;
while ((session = hashmap_first(m->sessions)))
session_free(session);
#if 0 /// elogind does not support autospawning of vts
safe_close(m->reserve_vt_fd);
#endif // 0
-
#if 1 /// elogind has to free its own data
elogind_manager_free(m);
#endif // 1
if (r < 0)
return log_error_errno(r, "Failed to attach bus to event loop: %m");
-#if 1 /// elogind has to setup its release agent
+#if 0 /// elogind has to setup its release agent
+ return 0;
+#else
elogind_bus_setup_system(m);
r = elogind_setup_cgroups_agent(m);
-#endif // 1
return r;
+#endif // 0
}
static int manager_vt_switch(sd_event_source *src, const struct signalfd_siginfo *si, void *data) {
#if 0 /// elogind parses its own config file
assert(m);
- return config_parse_many(PKGSYSCONFDIR "/logind.conf",
+ return config_parse_many_nulstr(PKGSYSCONFDIR "/logind.conf",
CONF_PATHS_NULSTR("systemd/logind.conf.d"),
"Login\0",
config_item_perf_lookup, logind_gperf_lookup,
log_set_target(LOG_TARGET_AUTO);
log_set_facility(LOG_AUTH);
log_parse_environment();
- log_open();
-
#ifdef ENABLE_DEBUG_ELOGIND
log_set_max_level(LOG_DEBUG);
+ log_set_target(LOG_TARGET_SYSLOG_OR_KMSG);
#endif // ENABLE_DEBUG_ELOGIND
+ log_open();
umask(0022);
"STOPPING=1\n"
"STATUS=Shutting down...");
- if (m)
- manager_free(m);
+ manager_free(m);
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}