logind-core.c revision d3e84ddb885e9d5f0ae9930eb905910e3a81f157
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/>.
96cde13ace6406582688028f3df5668a172ba628Zbigniew Jędrzejewski-Szmekint manager_add_device(Manager *m, const char *sysfs, bool master, Device **_device) {
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering /* we support adding master-flags, but not removing them */
d4fffc4b8beb86e77fd710c1f43913a490ed083aZbigniew Jędrzejewski-Szmek d = device_new(m, sysfs, master);
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, ULONG_TO_PTR((unsigned long) uid));
374ec6abf31ada6ca554cc8ea99b282373fac010Lennart Poetteringint manager_add_user_by_name(Manager *m, const char *name, User **_user) {
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poettering r = get_user_creds(&name, &uid, &gid, NULL, NULL);
aff38e74bd776471f15ba54b305a24b0251eb865Lennart Poettering return manager_add_user(m, uid, gid, name, _user);
aff38e74bd776471f15ba54b305a24b0251eb865Lennart 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);
aff38e74bd776471f15ba54b305a24b0251eb865Lennart Poetteringint manager_add_inhibitor(Manager *m, const char* id, Inhibitor **_inhibitor) {
1021b21bc6f8dd522b46116e8598b17f9f93f1b7Lennart Poetteringint manager_add_button(Manager *m, const char *name, Button **_button) {
a0ab566574303be1ca12cdb334f284cfd407caa5Lennart Poetteringint manager_watch_busname(Manager *m, const char *name) {
a016b9228f338cb9b380ce7e00826ef462767d98Lennart Poetteringvoid manager_drop_busname(Manager *m, const char *name) {
a016b9228f338cb9b380ce7e00826ef462767d98Lennart 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));
7027ff61a34a12487712b382a061c654acc3a679Lennart Poetteringint manager_process_seat_device(Manager *m, struct udev_device *d) {
143bfdaf0b890fa7acadf02d1eafacaef1b696bdHolger Hans Peter Freyther if (streq_ptr(udev_device_get_action(d), "remove")) {
143bfdaf0b890fa7acadf02d1eafacaef1b696bdHolger Hans Peter Freyther device = hashmap_get(m->devices, udev_device_get_syspath(d));
96cde13ace6406582688028f3df5668a172ba628Zbigniew Jędrzejewski-Szmek seat_add_to_gc_queue(device->seat);
const char *sn;
bool master;
if (!seat) {
Button *b;
assert(m);
button_free(b);
const char *sn;
button_open(b);
Session *s;
assert(m);
return -EINVAL;
*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)
int r = 0, fd;
if (fd < 0)
return -errno;
r = -errno;
assert(m);
return -EBUSY;
return log_oom();
r = sd_bus_call_method(
m->bus,
"org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
&error,
NULL,