]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/logind.h
logind: use pipe fd to detect when a session is dead
[thirdparty/systemd.git] / src / logind.h
CommitLineData
20263082
LP
1/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3#ifndef foologindhfoo
4#define foologindhfoo
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
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
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
19 General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with systemd; If not, see <http://www.gnu.org/licenses/>.
23***/
24
25#include <stdbool.h>
26#include <inttypes.h>
27#include <dbus/dbus.h>
28#include <libudev.h>
29
30#include "util.h"
31#include "list.h"
32#include "hashmap.h"
33#include "cgroup-util.h"
34
35/* TODO:
36 *
37 * recreate VTs when disallocated
20263082 38 * spawn user systemd
91f9dcaf 39 * direct client API
ed18b08b 40 * D-Bus method: AttachDevice(seat, device);
31b79c2b 41 * D-Bus method: SetLinger(user, bool b);
5eda94dd 42 *
20263082 43 * non-local X11 server
20263082 44 * reboot/shutdown halt management
20263082
LP
45 */
46
47typedef struct Manager Manager;
20263082 48
90821c93
LP
49#include "logind-device.h"
50#include "logind-seat.h"
51#include "logind-session.h"
52#include "logind-user.h"
20263082
LP
53
54struct Manager {
55 DBusConnection *bus;
56
57 Hashmap *devices;
58 Hashmap *seats;
59 Hashmap *sessions;
60 Hashmap *users;
61
14c3baca
LP
62 LIST_HEAD(Seat, seat_gc_queue);
63 LIST_HEAD(Session, session_gc_queue);
64 LIST_HEAD(User, user_gc_queue);
65
20263082
LP
66 struct udev *udev;
67 struct udev_monitor *udev_monitor;
68
69 int udev_fd;
70 int console_active_fd;
71 int bus_fd;
72 int epoll_fd;
73
3f49d45a 74 unsigned n_autovts;
20263082
LP
75
76 Seat *vtconsole;
77
78 char *cgroup_path;
98a28fef 79 char **controllers;
20263082 80
3f49d45a 81 char **kill_only_users, **kill_exclude_users;
20263082
LP
82
83 bool kill_user_processes;
98a28fef
LP
84
85 unsigned long session_counter;
1713813d
LP
86
87 Hashmap *cgroups;
31b79c2b
LP
88 Hashmap *pipe_fds;
89};
90
91enum {
92 FD_UDEV,
93 FD_CONSOLE,
94 FD_BUS,
95 FD_PIPE_BASE
20263082
LP
96};
97
20263082
LP
98Manager *manager_new(void);
99void manager_free(Manager *m);
14c3baca 100
20263082
LP
101int manager_add_device(Manager *m, const char *sysfs, Device **_device);
102int manager_add_seat(Manager *m, const char *id, Seat **_seat);
103int manager_add_session(Manager *m, User *u, const char *id, Session **_session);
104int manager_add_user(Manager *m, uid_t uid, gid_t gid, const char *name, User **_user);
105int manager_add_user_by_name(Manager *m, const char *name, User **_user);
106int manager_add_user_by_uid(Manager *m, uid_t uid, User **_user);
14c3baca 107
20263082
LP
108int manager_process_device(Manager *m, struct udev_device *d);
109int manager_dispatch_udev(Manager *m);
110int manager_dispatch_console(Manager *m);
14c3baca 111
20263082
LP
112int manager_enumerate_devices(Manager *m);
113int manager_enumerate_seats(Manager *m);
114int manager_enumerate_sessions(Manager *m);
115int manager_enumerate_users(Manager *m);
14c3baca 116
20263082
LP
117int manager_startup(Manager *m);
118int manager_run(Manager *m);
119int manager_spawn_autovt(Manager *m, int vtnr);
120
1713813d
LP
121void manager_cgroup_notify_empty(Manager *m, const char *cgroup);
122
14c3baca
LP
123void manager_gc(Manager *m);
124
a185c5aa
LP
125int manager_get_idle_hint(Manager *m, dual_timestamp *t);
126
20263082
LP
127bool x11_display_is_local(const char *display);
128
3f49d45a
LP
129extern const DBusObjectPathVTable bus_manager_vtable;
130
1713813d
LP
131DBusHandlerResult bus_message_filter(DBusConnection *c, DBusMessage *message, void *userdata);
132
9418f147
LP
133int manager_send_changed(Manager *manager, const char *properties);
134
20263082 135#endif