1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
6 This file is part of systemd.
8 Copyright 2011 Lennart Poettering
10 systemd is free software; you can redistribute it and/or modify it
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
13 (at your option) any later version.
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
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 typedef struct User User;
29 #include "logind-session.h"
31 typedef enum UserState {
32 USER_OFFLINE, /* Not logged in at all */
33 USER_LINGERING, /* Lingering has been enabled by the admin for this user */
34 USER_ONLINE, /* User logged in */
35 USER_ACTIVE, /* User logged in and has a session in the fg */
36 USER_CLOSING, /* User logged out, but processes still remain and lingering is not enabled */
38 _USER_STATE_INVALID = -1
55 dual_timestamp timestamp;
60 LIST_HEAD(Session, sessions);
61 LIST_FIELDS(User, gc_queue);
64 User* user_new(Manager *m, uid_t uid, gid_t gid, const char *name);
65 void user_free(User *u);
66 int user_check_gc(User *u, bool drop_not_started);
67 void user_add_to_gc_queue(User *u);
68 int user_start(User *u);
69 int user_stop(User *u);
70 UserState user_get_state(User *u);
71 int user_get_idle_hint(User *u, dual_timestamp *t);
72 int user_save(User *u);
73 int user_load(User *u);
74 int user_kill(User *u, int signo);
76 char *user_bus_path(User *s);
78 extern const DBusObjectPathVTable bus_user_vtable;
80 int user_send_signal(User *u, bool new_user);
81 int user_send_changed(User *u, const char *properties);
83 const char* user_state_to_string(UserState s);
84 UserState user_state_from_string(const char *s);