]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/login/logind-user.h
logind: introduce a state for session, being one of online, active, closing
[thirdparty/systemd.git] / src / login / logind-user.h
CommitLineData
90821c93
LP
1/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3#ifndef foologinduserhfoo
4#define foologinduserhfoo
5
6/***
7 This file is part of systemd.
8
9 Copyright 2011 Lennart Poettering
10
11 systemd is free software; you can redistribute it and/or modify it
5430f7f2
LP
12 under the terms of the GNU Lesser General Public License as published by
13 the Free Software Foundation; either version 2.1 of the License, or
90821c93
LP
14 (at your option) any later version.
15
16 systemd is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5430f7f2 19 Lesser General Public License for more details.
90821c93 20
5430f7f2 21 You should have received a copy of the GNU Lesser General Public License
90821c93
LP
22 along with systemd; If not, see <http://www.gnu.org/licenses/>.
23***/
24
25typedef struct User User;
26
27#include "list.h"
28#include "util.h"
29#include "logind.h"
30#include "logind-session.h"
31
32typedef enum UserState {
0604381b
LP
33 USER_OFFLINE, /* Not logged in at all */
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
42struct 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;
51 char *service;
52 char *cgroup_path;
53
54 Session *display;
55
56 dual_timestamp timestamp;
57
14c3baca 58 bool in_gc_queue:1;
9418f147 59 bool started:1;
14c3baca 60
90821c93 61 LIST_HEAD(Session, sessions);
14c3baca 62 LIST_FIELDS(User, gc_queue);
90821c93
LP
63};
64
65User* user_new(Manager *m, uid_t uid, gid_t gid, const char *name);
66void user_free(User *u);
4a4b033f 67int user_check_gc(User *u, bool drop_not_started);
14c3baca 68void user_add_to_gc_queue(User *u);
90821c93
LP
69int user_start(User *u);
70int user_stop(User *u);
90821c93 71UserState user_get_state(User *u);
a185c5aa 72int user_get_idle_hint(User *u, dual_timestamp *t);
90821c93
LP
73int user_save(User *u);
74int user_load(User *u);
de07ab16 75int user_kill(User *u, int signo);
90821c93 76
3f49d45a
LP
77char *user_bus_path(User *s);
78
79extern const DBusObjectPathVTable bus_user_vtable;
80
da119395 81int user_send_signal(User *u, bool new_user);
9418f147 82int user_send_changed(User *u, const char *properties);
da119395 83
90821c93
LP
84const char* user_state_to_string(UserState s);
85UserState user_state_from_string(const char *s);
86
87#endif