X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Flogin%2Flogind.h;h=8f6fb72dbeb853d56ea2d49d833cda14d455e10e;hp=c4bfd92cff415c1beb00052dfe426907e1eb731c;hb=a5c28308446550e0966825472babdf123fc976ac;hpb=3811439efe823ff3a44cbd46f979d1dd1d758f60 diff --git a/src/login/logind.h b/src/login/logind.h index c4bfd92cf..8f6fb72db 100644 --- a/src/login/logind.h +++ b/src/login/logind.h @@ -1,5 +1,3 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ - #pragma once /*** @@ -23,14 +21,16 @@ #include +#if 0 /// elogind needs the systems udev header #include "libudev.h" +#else +#include +#endif // 0 #include "sd-bus.h" #include "sd-event.h" -#include "cgroup-util.h" #include "hashmap.h" #include "list.h" -#include "path-lookup.h" #include "set.h" typedef struct Manager Manager; @@ -40,6 +40,13 @@ typedef struct Manager Manager; #include "logind-device.h" #include "logind-inhibit.h" +/// Additional includes needed by elogind +#include "cgroup-util.h" + +#if 1 /// elogind has to ident itself +#define MANAGER_IS_SYSTEM(m) ((m)->is_system) +#define MANAGER_IS_USER(m) (!((m)->is_system)) +#endif // 1 struct Manager { sd_event *event; sd_bus *bus; @@ -64,26 +71,31 @@ struct Manager { sd_event_source *udev_vcsa_event_source; sd_event_source *udev_button_event_source; +#if 0 /// elogind does not support autospawning of vts + int console_active_fd; + + unsigned n_autovts; + + unsigned reserve_vt; + int reserve_vt_fd; +#else /* Make sure the user cannot accidentally unmount our cgroup * file system */ int pin_cgroupfs_fd; + /* fd for handling cgroup socket if elogind is its own cgroups manager */ + int cgroups_agent_fd; + sd_event_source *cgroups_agent_event_source; + /* Flags */ - ManagerRunningAs running_as; bool test_run:1; + bool is_system:1; /* true if elogind is its own cgroups manager */ /* Data specific to the cgroup subsystem */ CGroupMask cgroup_supported; char *cgroup_root; int console_active_fd; - -/// elogind does not support autospawning of vts -#if 0 - unsigned n_autovts; - - unsigned reserve_vt; - int reserve_vt_fd; #endif // 0 Seat *seat0; @@ -103,8 +115,7 @@ struct Manager { * this is != 0 and encodes what is being done */ InhibitWhat action_what; -/// elogind does all relevant actions on its own. No systemd jobs and units. -#if 0 +#if 0 /// elogind does all relevant actions on its own. No systemd jobs and units. /* 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 */ @@ -118,8 +129,12 @@ struct Manager { contains the action we are supposed to perform after the delay is over */ HandleAction pending_action; -#endif // 0 + char **suspend_state, **suspend_mode; + char **hibernate_state, **hibernate_mode; + char **hybrid_sleep_state, **hybrid_sleep_mode; + +#endif // 0 sd_event_source *inhibit_timeout_source; char *scheduled_shutdown_type; @@ -154,10 +169,6 @@ struct Manager { bool remove_ipc; - char **suspend_state, **suspend_mode; - char **hibernate_state, **hibernate_mode; - char **hybrid_sleep_state, **hybrid_sleep_mode; - Hashmap *polkit_registry; usec_t holdoff_timeout_usec; @@ -165,6 +176,8 @@ struct Manager { size_t runtime_dir_size; uint64_t user_tasks_max; + uint64_t sessions_max; + uint64_t inhibitors_max; }; int manager_add_device(Manager *m, const char *sysfs, bool master, Device **_device); @@ -179,7 +192,9 @@ int manager_add_inhibitor(Manager *m, const char* id, Inhibitor **_inhibitor); int manager_process_seat_device(Manager *m, struct udev_device *d); int manager_process_button_device(Manager *m, struct udev_device *d); -// UNNEEDED int manager_spawn_autovt(Manager *m, unsigned int vtnr); +#if 0 /// UNNEEDED by elogind +int manager_spawn_autovt(Manager *m, unsigned int vtnr); +#endif // 0 bool manager_shall_kill(Manager *m, const char *user); @@ -192,28 +207,31 @@ bool manager_is_docked_or_external_displays(Manager *m); extern const sd_bus_vtable manager_vtable[]; -// UNNEEDED int match_job_removed(sd_bus_message *message, void *userdata, sd_bus_error *error); -// UNNEEDED int match_unit_removed(sd_bus_message *message, void *userdata, sd_bus_error *error); -// UNNEEDED int match_properties_changed(sd_bus_message *message, void *userdata, sd_bus_error *error); -// UNNEEDED int match_reloading(sd_bus_message *message, void *userdata, sd_bus_error *error); -// UNNEEDED int match_name_owner_changed(sd_bus_message *message, void *userdata, sd_bus_error *error); +#if 0 /// UNNEEDED by elogind +int match_job_removed(sd_bus_message *message, void *userdata, sd_bus_error *error); +int match_unit_removed(sd_bus_message *message, void *userdata, sd_bus_error *error); +int match_properties_changed(sd_bus_message *message, void *userdata, sd_bus_error *error); +int match_reloading(sd_bus_message *message, void *userdata, sd_bus_error *error); +int match_name_owner_changed(sd_bus_message *message, void *userdata, sd_bus_error *error); -/// eloginds own version does the action itself -#if 0 int bus_manager_shutdown_or_sleep_now_or_later(Manager *m, const char *unit_name, InhibitWhat w, sd_bus_error *error); #else +/// eloginds own version does the action itself int bus_manager_shutdown_or_sleep_now_or_later(Manager *m, HandleAction action, InhibitWhat w, sd_bus_error *error); #endif // 0 int manager_send_changed(Manager *manager, const char *property, ...) _sentinel_; -// UNNEEDED int manager_start_slice(Manager *manager, const char *slice, const char *description, const char *after, const char *after2, uint64_t tasks_max, sd_bus_error *error, char **job);// UNNEEDED int manager_start_scope(Manager *manager, const char *scope, pid_t pid, const char *slice, const char *description, const char *after, const char *after2, sd_bus_error *error, char **job); -// UNNEEDED int manager_start_unit(Manager *manager, const char *unit, sd_bus_error *error, char **job); -// UNNEEDED int manager_stop_unit(Manager *manager, const char *unit, sd_bus_error *error, char **job); -// UNNEEDED int manager_abandon_scope(Manager *manager, const char *scope, sd_bus_error *error); -// UNNEEDED int manager_kill_unit(Manager *manager, const char *unit, KillWho who, int signo, sd_bus_error *error); -// UNNEEDED int manager_unit_is_active(Manager *manager, const char *unit); -// UNNEEDED int manager_job_is_active(Manager *manager, const char *path); +#if 0 /// UNNEEDED by elogind +int manager_start_slice(Manager *manager, const char *slice, const char *description, const char *after, const char *after2, uint64_t tasks_max, sd_bus_error *error, char **job); +int manager_start_scope(Manager *manager, const char *scope, pid_t pid, const char *slice, const char *description, const char *after, const char *after2, uint64_t tasks_max, sd_bus_error *error, char **job); +int manager_start_unit(Manager *manager, const char *unit, sd_bus_error *error, char **job); +int manager_stop_unit(Manager *manager, const char *unit, sd_bus_error *error, char **job); +int manager_abandon_scope(Manager *manager, const char *scope, sd_bus_error *error); +int manager_kill_unit(Manager *manager, const char *unit, KillWho who, int signo, sd_bus_error *error); +int manager_unit_is_active(Manager *manager, const char *unit); +int manager_job_is_active(Manager *manager, const char *path); +#endif // 0 /* gperf lookup function */ const struct ConfigPerfItem* logind_gperf_lookup(const char *key, GPERF_LEN_TYPE length); @@ -221,12 +239,13 @@ const struct ConfigPerfItem* logind_gperf_lookup(const char *key, GPERF_LEN_TYPE int manager_set_lid_switch_ignore(Manager *m, usec_t until); int config_parse_tmpfs_size(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); +int config_parse_user_tasks_max(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); int manager_get_session_from_creds(Manager *m, sd_bus_message *message, const char *name, sd_bus_error *error, Session **ret); int manager_get_user_from_creds(Manager *m, sd_bus_message *message, uid_t uid, sd_bus_error *error, User **ret); int manager_get_seat_from_creds(Manager *m, sd_bus_message *message, const char *name, sd_bus_error *error, Seat **ret); -// UNNEEDED int manager_setup_wall_message_timer(Manager *m); -// UNNEEDED bool logind_wall_tty_filter(const char *tty, void *userdata); +int manager_setup_wall_message_timer(Manager *m); +bool logind_wall_tty_filter(const char *tty, void *userdata); int manager_dispatch_delayed(Manager *manager, bool timeout);