X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Flogin%2Flogind-user.h;h=f3fa4403d8284da07f40b6e3b338aefbfb405f68;hp=93e5fd934a0ad40ae886c8780aeadac07b4bacc6;hb=ad0ff86c7c90c3d652edb7c81ebd3f07f70a9a07;hpb=e96cd586c5195b73af74791280d8461510258b48 diff --git a/src/login/logind-user.h b/src/login/logind-user.h index 93e5fd934..f3fa4403d 100644 --- a/src/login/logind-user.h +++ b/src/login/logind-user.h @@ -1,7 +1,4 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ - -#ifndef foologinduserhfoo -#define foologinduserhfoo +#pragma once /*** This file is part of systemd. @@ -25,31 +22,38 @@ typedef struct User User; #include "list.h" -#include "util.h" #include "logind.h" -#include "logind-session.h" typedef enum UserState { - USER_OFFLINE, - USER_LINGERING, - USER_ONLINE, - USER_ACTIVE, - USER_CLOSING, + USER_OFFLINE, /* Not logged in at all */ + USER_OPENING, /* Is logging in */ + USER_LINGERING, /* Lingering has been enabled by the admin for this user */ + USER_ONLINE, /* User logged in */ + USER_ACTIVE, /* User logged in and has a session in the fg */ + USER_CLOSING, /* User logged out, but processes still remain and lingering is not enabled */ _USER_STATE_MAX, _USER_STATE_INVALID = -1 } UserState; struct User { Manager *manager; - uid_t uid; gid_t gid; char *name; - char *state_file; char *runtime_path; + + /* These are always NULL, and here just for logind-user-dbus.c + to easily provide a NULL value for the user's service and + slice properties. */ + char *slice; char *service; - char *cgroup_path; + + +#if 0 /// UNNEEDED by elogind + char *service_job; + char *slice_job; +#endif // 0 Session *display; @@ -57,31 +61,40 @@ struct User { bool in_gc_queue:1; bool started:1; + bool stopping:1; LIST_HEAD(Session, sessions); LIST_FIELDS(User, gc_queue); }; -User* user_new(Manager *m, uid_t uid, gid_t gid, const char *name); -void user_free(User *u); -int user_check_gc(User *u, bool drop_not_started); +int user_new(User **out, Manager *m, uid_t uid, gid_t gid, const char *name); +User *user_free(User *u); + +DEFINE_TRIVIAL_CLEANUP_FUNC(User *, user_free); + +bool user_check_gc(User *u, bool drop_not_started); void user_add_to_gc_queue(User *u); int user_start(User *u); -int user_stop(User *u); +int user_stop(User *u, bool force); +int user_finalize(User *u); UserState user_get_state(User *u); int user_get_idle_hint(User *u, dual_timestamp *t); int user_save(User *u); int user_load(User *u); int user_kill(User *u, int signo); +int user_check_linger_file(User *u); +void user_elect_display(User *u); +extern const sd_bus_vtable user_vtable[]; +int user_node_enumerator(sd_bus *bus, const char *path, void *userdata, char ***nodes, sd_bus_error *error); +int user_object_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *error); char *user_bus_path(User *s); -extern const DBusObjectPathVTable bus_user_vtable; - int user_send_signal(User *u, bool new_user); -int user_send_changed(User *u, const char *properties); +int user_send_changed(User *u, const char *properties, ...) _sentinel_; -const char* user_state_to_string(UserState s); -UserState user_state_from_string(const char *s); +const char* user_state_to_string(UserState s) _const_; +UserState user_state_from_string(const char *s) _pure_; -#endif +int bus_user_method_terminate(sd_bus_message *message, void *userdata, sd_bus_error *error); +int bus_user_method_kill(sd_bus_message *message, void *userdata, sd_bus_error *error);