logind-core.c revision b80120c4cba7d134b5437a58437a23fdf7ab2084
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering This file is part of systemd.
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering Copyright 2011 Lennart Poettering
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering systemd is free software; you can redistribute it and/or modify it
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering under the terms of the GNU Lesser General Public License as published by
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering (at your option) any later version.
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering systemd is distributed in the hope that it will be useful, but
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering Lesser General Public License for more details.
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering You should have received a copy of the GNU Lesser General Public License
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
d7bd3de0654669e65b9642c248c5fa6d1d9a9f61Lennart Poetteringint manager_add_device(Manager *m, const char *sysfs, bool master, Device **_device) {
d7bd3de0654669e65b9642c248c5fa6d1d9a9f61Lennart Poettering /* we support adding master-flags, but not removing them */
d7bd3de0654669e65b9642c248c5fa6d1d9a9f61Lennart Poetteringint manager_add_seat(Manager *m, const char *id, Seat **_seat) {
374ec6abf31ada6ca554cc8ea99b282373fac010Lennart Poetteringint manager_add_session(Manager *m, const char *id, Session **_session) {
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poetteringint manager_add_user(Manager *m, uid_t uid, gid_t gid, const char *name, User **_user) {
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poettering u = hashmap_get(m->users, UID_TO_PTR(uid));
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poetteringint manager_add_user_by_name(Manager *m, const char *name, User **_user) {
374ec6abf31ada6ca554cc8ea99b282373fac010Lennart Poettering r = get_user_creds(&name, &uid, &gid, NULL, NULL);
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poettering return manager_add_user(m, uid, gid, name, _user);
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poetteringint manager_add_user_by_uid(Manager *m, uid_t uid, User **_user) {
aff38e74bd776471f15ba54b305a24b0251eb865Lennart Poettering return manager_add_user(m, uid, p->pw_gid, p->pw_name, _user);
1021b21bc6f8dd522b46116e8598b17f9f93f1b7Lennart Poetteringint manager_add_inhibitor(Manager *m, const char* id, Inhibitor **_inhibitor) {
1021b21bc6f8dd522b46116e8598b17f9f93f1b7Lennart Poetteringint manager_add_button(Manager *m, const char *name, Button **_button) {
ae018d9bc900d6355dea4af05119b49c67945184Lennart Poetteringint manager_watch_busname(Manager *m, const char *name) {
78edb35ab4f4227485cb9ec816b43c37e0d5e62aLennart Poetteringvoid manager_drop_busname(Manager *m, const char *name) {
78edb35ab4f4227485cb9ec816b43c37e0d5e62aLennart Poettering /* keep it if the name still owns a controller */
a016b9228f338cb9b380ce7e00826ef462767d98Lennart Poettering if (session_is_controller(session, name))
a016b9228f338cb9b380ce7e00826ef462767d98Lennart Poettering free(set_remove(m->busnames, (char*) name));
a016b9228f338cb9b380ce7e00826ef462767d98Lennart Poetteringint manager_process_seat_device(Manager *m, struct udev_device *d) {
a016b9228f338cb9b380ce7e00826ef462767d98Lennart Poettering if (streq_ptr(udev_device_get_action(d), "remove")) {
a016b9228f338cb9b380ce7e00826ef462767d98Lennart Poettering device = hashmap_get(m->devices, udev_device_get_syspath(d));
143bfdaf0b890fa7acadf02d1eafacaef1b696bdHolger Hans Peter Freyther sn = udev_device_get_property_value(d, "ID_SEAT");
96cde13ace6406582688028f3df5668a172ba628Zbigniew Jędrzejewski-Szmek log_warning("Device with invalid seat name %s found, ignoring.", sn);
if (!seat) {
Button *b;
assert(m);
button_free(b);
const char *sn;
button_open(b);
Session *s;
assert(m);
return -EINVAL;
if (session)
*session = s;
User *u;
assert(m);
return -EINVAL;
*user = u;
Session *s;
bool idle_hint;
Iterator i;
assert(m);
int ih;
if (ih < 0)
return ih;
if (!ih) {
if (!idle_hint) {
ts = k;
idle_hint = false;
ts = k;
} else if (idle_hint) {
ts = k;
*t = ts;
return idle_hint;
assert(m);
if (!m->kill_user_processes)
if (fd < 0)
return -errno;
r = -errno;
assert(m);
return -EBUSY;
r = sd_bus_call_method(
m->bus,
"org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
&error,
NULL,
Iterator i;
Button *b;
if (b->docked)
return -ENOMEM;
r = udev_enumerate_scan_devices(e);
struct udev_device *p;
bool external = false;
return -ENOMEM;
p = udev_device_get_parent(d);
if (!nn)
if (!dash)
dash++;
external = true;
if (!external)
if (!enabled)
if (manager_is_docked(m)) {
n = manager_count_external_displays(m);