]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/login/logind.h
systemctl: show main and control PID explicitly in cgroup-show
[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"
f8e2fb7b 42#include "logind-inhibit.h"
20263082
LP
43
44struct Manager {
45 DBusConnection *bus;
46
47 Hashmap *devices;
48 Hashmap *seats;
49 Hashmap *sessions;
50 Hashmap *users;
f8e2fb7b 51 Hashmap *inhibitors;
20263082 52
14c3baca
LP
53 LIST_HEAD(Seat, seat_gc_queue);
54 LIST_HEAD(Session, session_gc_queue);
55 LIST_HEAD(User, user_gc_queue);
56
20263082 57 struct udev *udev;
30ed21ce
LP
58 struct udev_monitor *udev_seat_monitor, *udev_vcsa_monitor;
59
60 int udev_seat_fd;
61 int udev_vcsa_fd;
20263082 62
20263082
LP
63 int console_active_fd;
64 int bus_fd;
65 int epoll_fd;
66
3f49d45a 67 unsigned n_autovts;
20263082
LP
68
69 Seat *vtconsole;
70
71 char *cgroup_path;
193197e8 72 char **controllers, **reset_controllers;
20263082 73
3f49d45a 74 char **kill_only_users, **kill_exclude_users;
20263082
LP
75
76 bool kill_user_processes;
98a28fef
LP
77
78 unsigned long session_counter;
f8e2fb7b 79 unsigned long inhibit_counter;
1713813d
LP
80
81 Hashmap *cgroups;
f8e2fb7b
LP
82 Hashmap *session_fds;
83 Hashmap *inhibitor_fds;
31b79c2b
LP
84};
85
86enum {
30ed21ce
LP
87 FD_SEAT_UDEV,
88 FD_VCSA_UDEV,
31b79c2b
LP
89 FD_CONSOLE,
90 FD_BUS,
932e3ee7 91 FD_FIFO_BASE
20263082
LP
92};
93
20263082
LP
94Manager *manager_new(void);
95void manager_free(Manager *m);
14c3baca 96
20263082
LP
97int manager_add_device(Manager *m, const char *sysfs, Device **_device);
98int manager_add_seat(Manager *m, const char *id, Seat **_seat);
99int manager_add_session(Manager *m, User *u, const char *id, Session **_session);
100int manager_add_user(Manager *m, uid_t uid, gid_t gid, const char *name, User **_user);
101int manager_add_user_by_name(Manager *m, const char *name, User **_user);
102int manager_add_user_by_uid(Manager *m, uid_t uid, User **_user);
f8e2fb7b 103int manager_add_inhibitor(Manager *m, const char* id, Inhibitor **_inhibitor);
14c3baca 104
30ed21ce
LP
105int manager_process_seat_device(Manager *m, struct udev_device *d);
106int manager_dispatch_seat_udev(Manager *m);
107int manager_dispatch_vcsa_udev(Manager *m);
20263082 108int manager_dispatch_console(Manager *m);
14c3baca 109
20263082
LP
110int manager_enumerate_devices(Manager *m);
111int manager_enumerate_seats(Manager *m);
112int manager_enumerate_sessions(Manager *m);
113int manager_enumerate_users(Manager *m);
f8e2fb7b 114int manager_enumerate_inhibitors(Manager *m);
14c3baca 115
20263082
LP
116int manager_startup(Manager *m);
117int manager_run(Manager *m);
118int manager_spawn_autovt(Manager *m, int vtnr);
119
1713813d
LP
120void manager_cgroup_notify_empty(Manager *m, const char *cgroup);
121
4a4b033f 122void manager_gc(Manager *m, bool drop_not_started);
14c3baca 123
a185c5aa
LP
124int manager_get_idle_hint(Manager *m, dual_timestamp *t);
125
9b221b63
LP
126int manager_get_session_by_cgroup(Manager *m, const char *cgroup, Session **session);
127int manager_get_session_by_pid(Manager *m, pid_t pid, Session **session);
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
f975e971
LP
135/* gperf lookup function */
136const struct ConfigPerfItem* logind_gperf_lookup(const char *key, unsigned length);
137
20263082 138#endif