]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/logind.h
logind: use named pipes instead of fifos to keep track of sessions so that we can...
[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 *
20263082 37 * spawn user systemd
91f9dcaf 38 * direct client API
15e11d81 39 * add configuration file
a0a0c7f1 40 * verify access to SetIdleHint
932e3ee7
LP
41 *
42 * udev:
a0a0c7f1
LP
43 * drop redundant udev_device_get_is_initialized() use as soon as libudev is fixed
44 * properly escape/remove : and . from seat names in udev rules
45 * use device_has_tag() as soon as it is available
46 * trigger based on libudev if available
47 * enumerate recursively with libudev when triggering
5eda94dd 48 *
20263082 49 * non-local X11 server
20263082 50 * reboot/shutdown halt management
20263082
LP
51 */
52
53typedef struct Manager Manager;
20263082 54
90821c93
LP
55#include "logind-device.h"
56#include "logind-seat.h"
57#include "logind-session.h"
58#include "logind-user.h"
20263082
LP
59
60struct Manager {
61 DBusConnection *bus;
62
63 Hashmap *devices;
64 Hashmap *seats;
65 Hashmap *sessions;
66 Hashmap *users;
67
14c3baca
LP
68 LIST_HEAD(Seat, seat_gc_queue);
69 LIST_HEAD(Session, session_gc_queue);
70 LIST_HEAD(User, user_gc_queue);
71
20263082 72 struct udev *udev;
30ed21ce
LP
73 struct udev_monitor *udev_seat_monitor, *udev_vcsa_monitor;
74
75 int udev_seat_fd;
76 int udev_vcsa_fd;
20263082 77
20263082
LP
78 int console_active_fd;
79 int bus_fd;
80 int epoll_fd;
81
3f49d45a 82 unsigned n_autovts;
20263082
LP
83
84 Seat *vtconsole;
85
86 char *cgroup_path;
98a28fef 87 char **controllers;
20263082 88
3f49d45a 89 char **kill_only_users, **kill_exclude_users;
20263082
LP
90
91 bool kill_user_processes;
98a28fef
LP
92
93 unsigned long session_counter;
1713813d
LP
94
95 Hashmap *cgroups;
932e3ee7 96 Hashmap *fifo_fds;
31b79c2b
LP
97};
98
99enum {
30ed21ce
LP
100 FD_SEAT_UDEV,
101 FD_VCSA_UDEV,
31b79c2b
LP
102 FD_CONSOLE,
103 FD_BUS,
932e3ee7 104 FD_FIFO_BASE
20263082
LP
105};
106
20263082
LP
107Manager *manager_new(void);
108void manager_free(Manager *m);
14c3baca 109
20263082
LP
110int manager_add_device(Manager *m, const char *sysfs, Device **_device);
111int manager_add_seat(Manager *m, const char *id, Seat **_seat);
112int manager_add_session(Manager *m, User *u, const char *id, Session **_session);
113int manager_add_user(Manager *m, uid_t uid, gid_t gid, const char *name, User **_user);
114int manager_add_user_by_name(Manager *m, const char *name, User **_user);
115int manager_add_user_by_uid(Manager *m, uid_t uid, User **_user);
14c3baca 116
30ed21ce
LP
117int manager_process_seat_device(Manager *m, struct udev_device *d);
118int manager_dispatch_seat_udev(Manager *m);
119int manager_dispatch_vcsa_udev(Manager *m);
20263082 120int manager_dispatch_console(Manager *m);
14c3baca 121
20263082
LP
122int manager_enumerate_devices(Manager *m);
123int manager_enumerate_seats(Manager *m);
124int manager_enumerate_sessions(Manager *m);
125int manager_enumerate_users(Manager *m);
14c3baca 126
20263082
LP
127int manager_startup(Manager *m);
128int manager_run(Manager *m);
129int manager_spawn_autovt(Manager *m, int vtnr);
130
1713813d
LP
131void manager_cgroup_notify_empty(Manager *m, const char *cgroup);
132
14c3baca
LP
133void manager_gc(Manager *m);
134
a185c5aa
LP
135int manager_get_idle_hint(Manager *m, dual_timestamp *t);
136
3f49d45a
LP
137extern const DBusObjectPathVTable bus_manager_vtable;
138
1713813d
LP
139DBusHandlerResult bus_message_filter(DBusConnection *c, DBusMessage *message, void *userdata);
140
9418f147
LP
141int manager_send_changed(Manager *manager, const char *properties);
142
20263082 143#endif