chiark / gitweb /
logind: move lid switch handling from logind-main to logind-core
[elogind.git] / src / login / logind.c
index 3a514bbf81311cca8b43978519d9e1efb3659294..2d734ff26f70412c24d9c3781f754394d6a36af7 100644 (file)
@@ -60,6 +60,8 @@ Manager *manager_new(void) {
         m->idle_action = HANDLE_IGNORE;
         m->idle_action_not_before_usec = now(CLOCK_MONOTONIC);
 
+        m->runtime_dir_size = PAGE_ALIGN((size_t) (physical_memory() / 10)); /* 10% */
+
         m->devices = hashmap_new(string_hash_func, string_compare_func);
         m->seats = hashmap_new(string_hash_func, string_compare_func);
         m->sessions = hashmap_new(string_hash_func, string_compare_func);
@@ -144,6 +146,7 @@ void manager_free(Manager *m) {
         sd_event_source_unref(m->udev_device_event_source);
         sd_event_source_unref(m->udev_vcsa_event_source);
         sd_event_source_unref(m->udev_button_event_source);
+        sd_event_source_unref(m->lid_switch_ignore_event_source);
 
         if (m->console_active_fd >= 0)
                 close_nointr_nofail(m->console_active_fd);
@@ -994,6 +997,10 @@ int manager_startup(Manager *m) {
                 return r;
         }
 
+        r = manager_set_lid_switch_ignore(m, 0 + IGNORE_LID_SWITCH_STARTUP_USEC);
+        if (r < 0)
+                log_warning("Failed to set up lid switch ignore event source: %s", strerror(-r));
+
         /* Deserialize state */
         r = manager_enumerate_devices(m);
         if (r < 0)
@@ -1078,8 +1085,6 @@ int manager_run(Manager *m) {
                 if (r < 0)
                         return r;
         }
-
-        return 0;
 }
 
 static int manager_parse_config_file(Manager *m) {