X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flogin%2Flogind.h;h=904dc20467100157eecee5a550cefa5f711bc910;hb=fff40a51ccbb02e8dec4ff2ee505bc84f75e445c;hp=6fcef6f310d2956343fafd0163d6ef3dfe713b62;hpb=069cfc85f876bb6966cb5a9bbe0235f5064622cd;p=elogind.git diff --git a/src/login/logind.h b/src/login/logind.h index 6fcef6f31..904dc2046 100644 --- a/src/login/logind.h +++ b/src/login/logind.h @@ -1,7 +1,6 @@ /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ -#ifndef foologindhfoo -#define foologindhfoo +#pragma once /*** This file is part of systemd. @@ -41,6 +40,7 @@ typedef struct Manager Manager; #include "logind-user.h" #include "logind-inhibit.h" #include "logind-button.h" +#include "logind-action.h" struct Manager { DBusConnection *bus; @@ -69,6 +69,9 @@ struct Manager { unsigned n_autovts; + unsigned reserve_vt; + int reserve_vt_fd; + Seat *vtconsole; char *cgroup_path; @@ -81,23 +84,43 @@ struct Manager { unsigned long session_counter; unsigned long inhibit_counter; - Hashmap *cgroups; + Hashmap *session_cgroups; + Hashmap *user_cgroups; + Hashmap *session_fds; Hashmap *inhibitor_fds; Hashmap *button_fds; - /* If a shutdown was delayed due to a inhibitor this contains - the unit name we are supposed to start after the delay is - over */ - const char *delayed_unit; - InhibitWhat delayed_what; - usec_t delayed_timestamp; - usec_t inhibit_delay_max; - HandleButton handle_power_key; - HandleButton handle_sleep_key; - HandleButton handle_lid_switch; + /* If an action is currently being executed or is delayed, + * this is != 0 and encodes what is being done */ + InhibitWhat action_what; + + /* If a shutdown/suspend was delayed due to a inhibitor this + contains the unit name we are supposed to start after the + delay is over */ + const char *action_unit; + + /* If a shutdown/suspend is currently executed, then this is + * the job of it */ + char *action_job; + usec_t action_timestamp; + + int idle_action_fd; /* the timer_fd */ + usec_t idle_action_usec; + usec_t idle_action_not_before_usec; + HandleAction idle_action; + + HandleAction handle_power_key; + HandleAction handle_suspend_key; + HandleAction handle_hibernate_key; + HandleAction handle_lid_switch; + + bool power_key_ignore_inhibited; + bool suspend_key_ignore_inhibited; + bool hibernate_key_ignore_inhibited; + bool lid_switch_ignore_inhibited; }; enum { @@ -106,6 +129,7 @@ enum { FD_BUTTON_UDEV, FD_CONSOLE, FD_BUS, + FD_IDLE_ACTION, FD_OTHER_BASE }; @@ -128,6 +152,7 @@ int manager_dispatch_seat_udev(Manager *m); int manager_dispatch_vcsa_udev(Manager *m); int manager_dispatch_button_udev(Manager *m); int manager_dispatch_console(Manager *m); +int manager_dispatch_idle_action(Manager *m); int manager_enumerate_devices(Manager *m); int manager_enumerate_buttons(Manager *m); @@ -146,6 +171,7 @@ void manager_gc(Manager *m, bool drop_not_started); int manager_get_idle_hint(Manager *m, dual_timestamp *t); +int manager_get_user_by_cgroup(Manager *m, const char *cgroup, User **user); int manager_get_session_by_cgroup(Manager *m, const char *cgroup, Session **session); int manager_get_session_by_pid(Manager *m, pid_t pid, Session **session); @@ -161,5 +187,3 @@ int manager_dispatch_delayed(Manager *manager); /* gperf lookup function */ const struct ConfigPerfItem* logind_gperf_lookup(const char *key, unsigned length); - -#endif