]>
Commit | Line | Data |
---|---|---|
90821c93 LP |
1 | /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ |
2 | ||
c2f1db8f | 3 | #pragma once |
90821c93 LP |
4 | |
5 | /*** | |
6 | This file is part of systemd. | |
7 | ||
8 | Copyright 2011 Lennart Poettering | |
9 | ||
10 | systemd is free software; you can redistribute it and/or modify it | |
5430f7f2 LP |
11 | under the terms of the GNU Lesser General Public License as published by |
12 | the Free Software Foundation; either version 2.1 of the License, or | |
90821c93 LP |
13 | (at your option) any later version. |
14 | ||
15 | systemd is distributed in the hope that it will be useful, but | |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
5430f7f2 | 18 | Lesser General Public License for more details. |
90821c93 | 19 | |
5430f7f2 | 20 | You should have received a copy of the GNU Lesser General Public License |
90821c93 LP |
21 | along with systemd; If not, see <http://www.gnu.org/licenses/>. |
22 | ***/ | |
23 | ||
24 | typedef struct User User; | |
25 | ||
26 | #include "list.h" | |
27 | #include "util.h" | |
28 | #include "logind.h" | |
29 | #include "logind-session.h" | |
30 | ||
31 | typedef enum UserState { | |
0604381b | 32 | USER_OFFLINE, /* Not logged in at all */ |
fb6becb4 | 33 | USER_OPENING, /* Is logging in */ |
0604381b LP |
34 | USER_LINGERING, /* Lingering has been enabled by the admin for this user */ |
35 | USER_ONLINE, /* User logged in */ | |
36 | USER_ACTIVE, /* User logged in and has a session in the fg */ | |
37 | USER_CLOSING, /* User logged out, but processes still remain and lingering is not enabled */ | |
90821c93 LP |
38 | _USER_STATE_MAX, |
39 | _USER_STATE_INVALID = -1 | |
40 | } UserState; | |
41 | ||
42 | struct User { | |
43 | Manager *manager; | |
44 | ||
45 | uid_t uid; | |
46 | gid_t gid; | |
47 | char *name; | |
48 | ||
49 | char *state_file; | |
50 | char *runtime_path; | |
fb6becb4 | 51 | |
90821c93 | 52 | char *service; |
9444b1f2 | 53 | char *slice; |
90821c93 | 54 | |
fb6becb4 LP |
55 | char *service_job; |
56 | char *slice_job; | |
57 | ||
90821c93 LP |
58 | Session *display; |
59 | ||
60 | dual_timestamp timestamp; | |
61 | ||
14c3baca | 62 | bool in_gc_queue:1; |
9418f147 | 63 | bool started:1; |
405e0255 | 64 | bool closing:1; |
14c3baca | 65 | |
90821c93 | 66 | LIST_HEAD(Session, sessions); |
14c3baca | 67 | LIST_FIELDS(User, gc_queue); |
90821c93 LP |
68 | }; |
69 | ||
70 | User* user_new(Manager *m, uid_t uid, gid_t gid, const char *name); | |
71 | void user_free(User *u); | |
cc377381 | 72 | bool user_check_gc(User *u, bool drop_not_started); |
14c3baca | 73 | void user_add_to_gc_queue(User *u); |
90821c93 LP |
74 | int user_start(User *u); |
75 | int user_stop(User *u); | |
405e0255 | 76 | int user_finalize(User *u); |
90821c93 | 77 | UserState user_get_state(User *u); |
a185c5aa | 78 | int user_get_idle_hint(User *u, dual_timestamp *t); |
90821c93 LP |
79 | int user_save(User *u); |
80 | int user_load(User *u); | |
de07ab16 | 81 | int user_kill(User *u, int signo); |
90821c93 | 82 | |
cc377381 LP |
83 | extern const sd_bus_vtable user_vtable[]; |
84 | int user_node_enumerator(sd_bus *bus, const char *path, char ***nodes, void *userdata); | |
85 | int user_object_find(sd_bus *bus, const char *path, const char *interface, void **found, void *userdata); | |
3f49d45a LP |
86 | char *user_bus_path(User *s); |
87 | ||
da119395 | 88 | int user_send_signal(User *u, bool new_user); |
cc377381 | 89 | int user_send_changed(User *u, const char *properties, ...) _sentinel_; |
da119395 | 90 | |
44a6b1b6 ZJS |
91 | const char* user_state_to_string(UserState s) _const_; |
92 | UserState user_state_from_string(const char *s) _pure_; |