]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/login/logind.h
relicense to LGPLv2.1 (with exceptions)
[thirdparty/systemd.git] / src / login / 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
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
20263082
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.
20263082 20
5430f7f2 21 You should have received a copy of the GNU Lesser General Public License
20263082
LP
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"
d7832d2c 31#include "audit.h"
20263082
LP
32#include "list.h"
33#include "hashmap.h"
34#include "cgroup-util.h"
35
20263082 36typedef struct Manager Manager;
20263082 37
90821c93
LP
38#include "logind-device.h"
39#include "logind-seat.h"
40#include "logind-session.h"
41#include "logind-user.h"
20263082
LP
42
43struct Manager {
44 DBusConnection *bus;
45
46 Hashmap *devices;
47 Hashmap *seats;
48 Hashmap *sessions;
49 Hashmap *users;
50
14c3baca
LP
51 LIST_HEAD(Seat, seat_gc_queue);
52 LIST_HEAD(Session, session_gc_queue);
53 LIST_HEAD(User, user_gc_queue);
54
20263082 55 struct udev *udev;
30ed21ce
LP
56 struct udev_monitor *udev_seat_monitor, *udev_vcsa_monitor;
57
58 int udev_seat_fd;
59 int udev_vcsa_fd;
20263082 60
20263082
LP
61 int console_active_fd;
62 int bus_fd;
63 int epoll_fd;
64
3f49d45a 65 unsigned n_autovts;
20263082
LP
66
67 Seat *vtconsole;
68
69 char *cgroup_path;
193197e8 70 char **controllers, **reset_controllers;
20263082 71
3f49d45a 72 char **kill_only_users, **kill_exclude_users;
20263082
LP
73
74 bool kill_user_processes;
98a28fef
LP
75
76 unsigned long session_counter;
1713813d
LP
77
78 Hashmap *cgroups;
932e3ee7 79 Hashmap *fifo_fds;
31b79c2b
LP
80};
81
82enum {
30ed21ce
LP
83 FD_SEAT_UDEV,
84 FD_VCSA_UDEV,
31b79c2b
LP
85 FD_CONSOLE,
86 FD_BUS,
932e3ee7 87 FD_FIFO_BASE
20263082
LP
88};
89
20263082
LP
90Manager *manager_new(void);
91void manager_free(Manager *m);
14c3baca 92
20263082
LP
93int manager_add_device(Manager *m, const char *sysfs, Device **_device);
94int manager_add_seat(Manager *m, const char *id, Seat **_seat);
95int manager_add_session(Manager *m, User *u, const char *id, Session **_session);
96int manager_add_user(Manager *m, uid_t uid, gid_t gid, const char *name, User **_user);
97int manager_add_user_by_name(Manager *m, const char *name, User **_user);
98int manager_add_user_by_uid(Manager *m, uid_t uid, User **_user);
14c3baca 99
30ed21ce
LP
100int manager_process_seat_device(Manager *m, struct udev_device *d);
101int manager_dispatch_seat_udev(Manager *m);
102int manager_dispatch_vcsa_udev(Manager *m);
20263082 103int manager_dispatch_console(Manager *m);
14c3baca 104
20263082
LP
105int manager_enumerate_devices(Manager *m);
106int manager_enumerate_seats(Manager *m);
107int manager_enumerate_sessions(Manager *m);
108int manager_enumerate_users(Manager *m);
14c3baca 109
20263082
LP
110int manager_startup(Manager *m);
111int manager_run(Manager *m);
112int manager_spawn_autovt(Manager *m, int vtnr);
113
1713813d
LP
114void manager_cgroup_notify_empty(Manager *m, const char *cgroup);
115
4a4b033f 116void manager_gc(Manager *m, bool drop_not_started);
14c3baca 117
a185c5aa
LP
118int manager_get_idle_hint(Manager *m, dual_timestamp *t);
119
9b221b63
LP
120int manager_get_session_by_cgroup(Manager *m, const char *cgroup, Session **session);
121int manager_get_session_by_pid(Manager *m, pid_t pid, Session **session);
122
3f49d45a
LP
123extern const DBusObjectPathVTable bus_manager_vtable;
124
1713813d
LP
125DBusHandlerResult bus_message_filter(DBusConnection *c, DBusMessage *message, void *userdata);
126
9418f147
LP
127int manager_send_changed(Manager *manager, const char *properties);
128
f975e971
LP
129/* gperf lookup function */
130const struct ConfigPerfItem* logind_gperf_lookup(const char *key, unsigned length);
131
20263082 132#endif