X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flogin%2Flogind.c;h=db9882323ff03a70a7a50fe7f8c9b6a55a5d3762;hb=22fdeadcc06e95fe41ac4de872ec245c0887547f;hp=fd113b3e79437db5451b63eaeedaf753dcf09ff9;hpb=f9cd6be10ece07e10488c05e270a0b5860779864;p=elogind.git diff --git a/src/login/logind.c b/src/login/logind.c index fd113b3e7..db9882323 100644 --- a/src/login/logind.c +++ b/src/login/logind.c @@ -49,6 +49,7 @@ Manager *manager_new(void) { m->n_autovts = 6; m->reserve_vt = 6; + m->remove_ipc = true; m->inhibit_delay_max = 5 * USEC_PER_SEC; m->handle_power_key = HANDLE_POWEROFF; m->handle_suspend_key = HANDLE_SUSPEND; @@ -60,6 +61,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); @@ -146,8 +149,7 @@ void manager_free(Manager *m) { 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); + safe_close(m->console_active_fd); if (m->udev_seat_monitor) udev_monitor_unref(m->udev_seat_monitor); @@ -166,8 +168,7 @@ void manager_free(Manager *m) { sd_bus_unref(m->bus); sd_event_unref(m->event); - if (m->reserve_vt_fd >= 0) - close_nointr_nofail(m->reserve_vt_fd); + safe_close(m->reserve_vt_fd); strv_free(m->kill_only_users); strv_free(m->kill_exclude_users); @@ -960,46 +961,6 @@ static int manager_dispatch_idle_action(sd_event_source *s, uint64_t t, void *us return 0; } -static int lid_switch_ignore_handler(sd_event_source *e, uint64_t usec, void *userdata) { - Manager *m = userdata; - - assert(e); - assert(m); - - m->lid_switch_ignore_event_source = sd_event_source_unref(m->lid_switch_ignore_event_source); - return 0; -} - -int manager_set_lid_switch_ignore(Manager *m, usec_t until) { - int r; - - assert(m); - - if (until <= now(CLOCK_MONOTONIC)) - return 0; - - /* We want to ignore the lid switch for a while after each - * suspend, and after boot-up. Hence let's install a timer for - * this. As long as the event source exists we ignore the lid - * switch. */ - - if (m->lid_switch_ignore_event_source) { - usec_t u; - - r = sd_event_source_get_time(m->lid_switch_ignore_event_source, &u); - if (r < 0) - return r; - - if (until <= u) - return 0; - - r = sd_event_source_set_time(m->lid_switch_ignore_event_source, until); - } else - r = sd_event_add_monotonic(m->event, &m->lid_switch_ignore_event_source, until, 0, lid_switch_ignore_handler, m); - - return r; -} - int manager_startup(Manager *m) { int r; Seat *seat;