login: Clean up includes

Split out of #37344.
This commit is contained in:
Daan De Meyer
2025-05-21 18:09:28 +02:00
parent 64943cac5d
commit 6ad1d1ede6
47 changed files with 191 additions and 246 deletions
+3 -2
View File
@@ -3,7 +3,6 @@
#include <fcntl.h>
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "sd-bus.h"
@@ -13,16 +12,18 @@
#include "bus-error.h"
#include "bus-locator.h"
#include "bus-util.h"
#include "errno-util.h"
#include "fd-util.h"
#include "format-table.h"
#include "format-util.h"
#include "log.h"
#include "main-func.h"
#include "pager.h"
#include "polkit-agent.h"
#include "pretty-print.h"
#include "process-util.h"
#include "runtime-scope.h"
#include "signal-util.h"
#include "string-util.h"
#include "strv.h"
#include "terminal-util.h"
#include "user-util.h"
+5 -6
View File
@@ -1,11 +1,11 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <getopt.h>
#include <locale.h>
#include <unistd.h>
#include "sd-bus.h"
#include "sd-journal.h"
#include "alloc-util.h"
#include "build.h"
@@ -17,24 +17,23 @@
#include "cgroup-show.h"
#include "cgroup-util.h"
#include "format-table.h"
#include "format-util.h"
#include "log.h"
#include "logs-show.h"
#include "macro.h"
#include "main-func.h"
#include "memory-util.h"
#include "pager.h"
#include "parse-argument.h"
#include "parse-util.h"
#include "polkit-agent.h"
#include "pretty-print.h"
#include "process-util.h"
#include "rlimit-util.h"
#include "signal-util.h"
#include "runtime-scope.h"
#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "sysfs-show.h"
#include "terminal-util.h"
#include "unit-name.h"
#include "time-util.h"
#include "user-util.h"
#include "verbs.h"
+3 -2
View File
@@ -2,15 +2,17 @@
#include <unistd.h>
#include "sd-bus.h"
#include "sd-messages.h"
#include "alloc-util.h"
#include "bitfield.h"
#include "bus-error.h"
#include "bus-unit-util.h"
#include "bus-util.h"
#include "conf-parser.h"
#include "extract-word.h"
#include "format-util.h"
#include "hashmap.h"
#include "logind.h"
#include "logind-action.h"
#include "logind-dbus.h"
@@ -19,7 +21,6 @@
#include "process-util.h"
#include "special.h"
#include "string-table.h"
#include "terminal-util.h"
#include "user-util.h"
static const HandleActionData handle_action_data_table[_HANDLE_ACTION_MAX] = {
+3 -5
View File
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "conf-parser.h"
#include "logind-forward.h"
#include "logind-inhibit.h"
#include "sleep-config.h"
@@ -32,8 +32,6 @@ typedef enum HandleAction {
_HANDLE_ACTION_INVALID = -EINVAL,
} HandleAction;
typedef struct HandleActionData HandleActionData;
typedef enum HandleActionSleepMask {
HANDLE_SLEEP_SUSPEND_MASK = 1U << HANDLE_SUSPEND,
HANDLE_SLEEP_HIBERNATE_MASK = 1U << HANDLE_HIBERNATE,
@@ -55,7 +53,7 @@ static inline bool HANDLE_ACTION_IS_SLEEP(HandleAction a) {
return a >= _HANDLE_ACTION_SLEEP_FIRST && a <= _HANDLE_ACTION_SLEEP_LAST;
}
struct HandleActionData {
typedef struct HandleActionData {
HandleAction handle;
const char *target;
InhibitWhat inhibit_what;
@@ -66,7 +64,7 @@ struct HandleActionData {
const char* message_id;
const char* message;
const char* log_verb;
};
} HandleActionData;
int handle_action_get_enabled_sleep_actions(HandleActionSleepMask mask, char ***ret);
HandleAction handle_action_sleep_select(Manager *m);
+7 -1
View File
@@ -1,12 +1,18 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "sd-bus.h"
#include "sd-device.h"
#include "sd-event.h"
#include "alloc-util.h"
#include "bus-message-util.h"
#include "bus-util.h"
#include "device-util.h"
#include "format-util.h"
#include "hash-funcs.h"
#include "logind.h"
#include "logind-brightness.h"
#include "process-util.h"
#include "set.h"
#include "stdio-util.h"
/* Brightness and LED devices tend to be very slow to write to (often being I2C and such). Writes to the
+1 -4
View File
@@ -1,9 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "sd-bus.h"
#include "sd-device.h"
typedef struct Manager Manager;
#include "logind-forward.h"
int manager_write_brightness(Manager *m, sd_device *device, uint32_t brightness, sd_bus_message *message);
+3 -1
View File
@@ -1,16 +1,18 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <fcntl.h>
#include <linux/input.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include "sd-event.h"
#include "sd-messages.h"
#include "alloc-util.h"
#include "async.h"
#include "fd-util.h"
#include "hashmap.h"
#include "log.h"
#include "logind.h"
#include "logind-button.h"
#include "logind-dbus.h"
+1 -5
View File
@@ -1,11 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include "sd-event.h"
typedef struct Manager Manager;
#include "logind-forward.h"
typedef enum ButtonModifierMask {
BUTTON_MODIFIER_NONE = 0,
+2 -4
View File
@@ -3,21 +3,21 @@
#include <fcntl.h>
#include <linux/vt.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include "sd-bus.h"
#include "sd-device.h"
#include "alloc-util.h"
#include "battery-util.h"
#include "bus-error.h"
#include "bus-locator.h"
#include "bus-util.h"
#include "cgroup-util.h"
#include "conf-parser.h"
#include "device-util.h"
#include "efi-loader.h"
#include "errno-util.h"
#include "fd-util.h"
#include "hashmap.h"
#include "limits-util.h"
#include "logind.h"
#include "logind-button.h"
@@ -25,9 +25,7 @@
#include "logind-seat.h"
#include "logind-session.h"
#include "logind-user.h"
#include "logind-utmp.h"
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "stdio-util.h"
#include "strv.h"
+14 -11
View File
@@ -1,9 +1,10 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <pwd.h>
#include <sys/stat.h>
#include <unistd.h>
#include "sd-bus.h"
#include "sd-device.h"
#include "sd-messages.h"
@@ -15,6 +16,7 @@
#include "bus-error.h"
#include "bus-get-properties.h"
#include "bus-locator.h"
#include "bus-object.h"
#include "bus-polkit.h"
#include "bus-unit-util.h"
#include "bus-util.h"
@@ -26,13 +28,16 @@
#include "efivars.h"
#include "env-file.h"
#include "env-util.h"
#include "errno-util.h"
#include "escape.h"
#include "event-util.h"
#include "fd-util.h"
#include "fileio.h"
#include "format-util.h"
#include "fs-util.h"
#include "hashmap.h"
#include "login-util.h"
#include "logind-session.h"
#include "logind.h"
#include "logind-action.h"
#include "logind-dbus.h"
@@ -44,22 +49,20 @@
#include "logind-user-dbus.h"
#include "logind-utmp.h"
#include "mkdir-label.h"
#include "os-util.h"
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "reboot-util.h"
#include "selinux-util.h"
#include "serialize.h"
#include "signal-util.h"
#include "sleep-config.h"
#include "special.h"
#include "stdio-util.h"
#include "strv.h"
#include "terminal-util.h"
#include "tmpfile-util.h"
#include "unit-name.h"
#include "user-record.h"
#include "user-util.h"
#include "utmp-wtmp.h"
#include "virt.h"
#include "wall.h"
@@ -145,9 +148,9 @@ int manager_get_session_from_creds(
assert(m);
assert(ret);
if (SESSION_IS_SELF(name)) /* the caller's own session */
if (session_is_self(name)) /* the caller's own session */
return get_sender_session(m, message, false, error, ret);
if (SESSION_IS_AUTO(name)) /* The caller's own session if they have one, otherwise their user's display session */
if (session_is_auto(name)) /* The caller's own session if they have one, otherwise their user's display session */
return get_sender_session(m, message, true, error, ret);
session = hashmap_get(m->sessions, name);
@@ -217,7 +220,7 @@ int manager_get_seat_from_creds(
assert(m);
assert(ret);
if (SEAT_IS_SELF(name) || SEAT_IS_AUTO(name)) {
if (seat_is_self(name) || seat_is_auto(name)) {
Session *session;
/* Use these special seat names as session names */
@@ -872,8 +875,8 @@ static int manager_choose_session_id(
} while (hashmap_contains(m->sessions, id));
/* The generated names should not clash with 'auto' or 'self' */
assert(!SESSION_IS_SELF(id));
assert(!SESSION_IS_AUTO(id));
assert(!session_is_self(id));
assert(!session_is_auto(id));
*ret_id = TAKE_PTR(id);
return 0;
@@ -1792,7 +1795,7 @@ static int method_attach_device(sd_bus_message *message, void *userdata, sd_bus_
if (!path_startswith(sysfs, "/sys"))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Path %s is not in /sys", sysfs);
if (SEAT_IS_SELF(seat) || SEAT_IS_AUTO(seat)) {
if (seat_is_self(seat) || seat_is_auto(seat)) {
Seat *found;
r = manager_get_seat_from_creds(m, message, seat, error, &found);
+1 -10
View File
@@ -1,16 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "sd-bus.h"
#include "bus-object.h"
#include "logind-session.h"
#include "macro.h"
typedef struct Manager Manager;
typedef struct User User;
typedef struct Seat Seat;
typedef struct HandleActionData HandleActionData;
#include "logind-forward.h"
int manager_get_session_from_creds(Manager *m, sd_bus_message *message, const char *name, sd_bus_error *error, Session **ret);
int manager_get_user_from_creds(Manager *m, sd_bus_message *message, uid_t uid, sd_bus_error *error, User **ret);
+1
View File
@@ -3,6 +3,7 @@
#include <string.h>
#include "alloc-util.h"
#include "hashmap.h"
#include "logind.h"
#include "logind-device.h"
#include "logind-seat.h"
+3 -7
View File
@@ -2,14 +2,10 @@
#pragma once
#include "list.h"
#include "logind-forward.h"
#include "time-util.h"
typedef struct Device Device;
typedef struct Manager Manager;
typedef struct Seat Seat;
typedef struct SessionDevice SessionDevice;
struct Device {
typedef struct Device {
Manager *manager;
char *sysfs;
@@ -20,7 +16,7 @@ struct Device {
LIST_FIELDS(Device, devices);
LIST_HEAD(SessionDevice, session_devices);
};
} Device;
Device* device_new(Manager *m, const char *sysfs, bool master);
void device_free(Device *d);
+20
View File
@@ -0,0 +1,20 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "conf-parser-forward.h" /* IWYU pragma: export */
#include "forward.h" /* IWYU pragma: export */
typedef enum InhibitWhat InhibitWhat;
typedef enum KillWhom KillWhom;
typedef enum SessionType SessionType;
typedef enum SessionClass SessionClass;
typedef struct HandleActionData HandleActionData;
typedef struct Device Device;
typedef struct Manager Manager;
typedef struct Seat Seat;
typedef struct SessionDevice SessionDevice;
typedef struct Session Session;
typedef struct User User;
typedef struct Inhibitor Inhibitor;
typedef struct Button Button;
+6 -4
View File
@@ -1,27 +1,29 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <threads.h>
#include <unistd.h>
#include "sd-event.h"
#include "alloc-util.h"
#include "env-file.h"
#include "errno-list.h"
#include "errno-util.h"
#include "escape.h"
#include "extract-word.h"
#include "fd-util.h"
#include "fileio.h"
#include "format-util.h"
#include "fs-util.h"
#include "hashmap.h"
#include "io-util.h"
#include "log.h"
#include "logind-session.h"
#include "logind.h"
#include "logind-dbus.h"
#include "logind-inhibit.h"
#include "mkdir-label.h"
#include "parse-util.h"
#include "path-util.h"
#include "string-table.h"
#include "string-util.h"
+3 -7
View File
@@ -1,14 +1,10 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "sd-event.h"
#include "logind-forward.h"
#include "pidref.h"
#include "time-util.h"
typedef struct Inhibitor Inhibitor;
typedef struct Manager Manager;
typedef enum InhibitWhat {
INHIBIT_SHUTDOWN = 1 << 0,
INHIBIT_SLEEP = 1 << 1,
@@ -30,7 +26,7 @@ typedef enum InhibitMode {
_INHIBIT_MODE_INVALID = -EINVAL,
} InhibitMode;
struct Inhibitor {
typedef struct Inhibitor {
Manager *manager;
sd_event_source *event_source;
@@ -52,7 +48,7 @@ struct Inhibitor {
char *fifo_path;
int fifo_fd;
};
} Inhibitor;
int inhibitor_new(Manager *m, const char* id, Inhibitor **ret);
Inhibitor* inhibitor_free(Inhibitor *i);
-1
View File
@@ -3,7 +3,6 @@
#include "bus-polkit.h"
#include "logind.h"
#include "logind-polkit.h"
#include "user-util.h"
int check_polkit_chvt(sd_bus_message *message, Manager *manager, sd_bus_error *error) {
#if ENABLE_POLKIT
+1 -5
View File
@@ -1,10 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "sd-bus.h"
#include "bus-object.h"
typedef struct Manager Manager;
#include "logind-forward.h"
int check_polkit_chvt(sd_bus_message *message, Manager *manager, sd_bus_error *error);
+5 -2
View File
@@ -1,13 +1,15 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include "sd-bus.h"
#include "alloc-util.h"
#include "bus-common-errors.h"
#include "bus-get-properties.h"
#include "bus-label.h"
#include "bus-object.h"
#include "bus-polkit.h"
#include "bus-util.h"
#include "hashmap.h"
#include "logind-session.h"
#include "logind.h"
#include "logind-dbus.h"
#include "logind-polkit.h"
@@ -15,6 +17,7 @@
#include "logind-seat-dbus.h"
#include "logind-session-dbus.h"
#include "logind-user.h"
#include "string-util.h"
#include "strv.h"
#include "user-util.h"
+1 -6
View File
@@ -1,12 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "sd-bus.h"
#include "bus-object.h"
#include "macro.h"
typedef struct Seat Seat;
#include "logind-forward.h"
extern const BusObjectImplementation seat_object;
+12 -2
View File
@@ -1,6 +1,5 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -14,7 +13,9 @@
#include "fileio.h"
#include "format-util.h"
#include "fs-util.h"
#include "hashmap.h"
#include "id128-util.h"
#include "log.h"
#include "logind.h"
#include "logind-device.h"
#include "logind-seat.h"
@@ -24,12 +25,13 @@
#include "logind-session-device.h"
#include "logind-user.h"
#include "mkdir-label.h"
#include "parse-util.h"
#include "path-util.h"
#include "set.h"
#include "stdio-util.h"
#include "string-util.h"
#include "terminal-util.h"
#include "tmpfile-util.h"
#include "user-record.h"
int seat_new(Manager *m, const char *id, Seat **ret) {
_cleanup_(seat_freep) Seat *s = NULL;
@@ -768,3 +770,11 @@ bool seat_name_is_valid(const char *name) {
return true;
}
bool seat_is_self(const char *name) {
return isempty(name) || streq(name, "self");
}
bool seat_is_auto(const char *name) {
return streq_ptr(name, "auto");
}
+5 -21
View File
@@ -1,20 +1,10 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "sd-device.h"
#include "list.h"
#include "memory-util.h"
#include "set.h"
#include "string-util.h"
#include "time-util.h"
#include "logind-forward.h"
typedef struct Device Device;
typedef struct Manager Manager;
typedef struct Seat Seat;
typedef struct Session Session;
struct Seat {
typedef struct Seat {
Manager *manager;
char *id;
@@ -34,7 +24,7 @@ struct Seat {
bool started:1;
LIST_FIELDS(Seat, gc_queue);
};
} Seat;
int seat_new(Manager *m, const char *id, Seat **ret);
Seat* seat_free(Seat *s);
@@ -75,11 +65,5 @@ bool seat_may_gc(Seat *s, bool drop_not_started);
void seat_add_to_gc_queue(Seat *s);
bool seat_name_is_valid(const char *name);
static inline bool SEAT_IS_SELF(const char *name) {
return isempty(name) || streq(name, "self");
}
static inline bool SEAT_IS_AUTO(const char *name) {
return streq_ptr(name, "auto");
}
bool seat_is_self(const char *name);
bool seat_is_auto(const char *name);
+9 -2
View File
@@ -1,18 +1,23 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <sys/eventfd.h>
#include "sd-bus.h"
#include "sd-device.h"
#include "alloc-util.h"
#include "bus-common-errors.h"
#include "bus-get-properties.h"
#include "bus-label.h"
#include "bus-object.h"
#include "bus-polkit.h"
#include "bus-util.h"
#include "device-util.h"
#include "devnum-util.h"
#include "errno-util.h"
#include "fd-util.h"
#include "format-util.h"
#include "hashmap.h"
#include "log.h"
#include "logind.h"
#include "logind-brightness.h"
#include "logind-dbus.h"
@@ -26,8 +31,10 @@
#include "logind-user-dbus.h"
#include "path-util.h"
#include "signal-util.h"
#include "string-util.h"
#include "strv.h"
#include "terminal-util.h"
#include "user-record.h"
#include "user-util.h"
static int property_get_user(
+1 -7
View File
@@ -1,13 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "sd-bus.h"
#include "bus-object.h"
#include "macro.h"
typedef struct Manager Manager;
typedef struct Session Session;
#include "logind-forward.h"
extern const BusObjectImplementation session_object;
+5 -4
View File
@@ -5,16 +5,17 @@
#include <linux/input.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/sysmacros.h>
#include "sd-daemon.h"
#include "sd-bus.h"
#include "sd-device.h"
#include "alloc-util.h"
#include "bus-util.h"
#include "daemon-util.h"
#include "device-util.h"
#include "errno-util.h"
#include "fd-util.h"
#include "hashmap.h"
#include "logind.h"
#include "logind-device.h"
#include "logind-seat.h"
@@ -22,7 +23,7 @@
#include "logind-session-dbus.h"
#include "logind-session-device.h"
#include "missing_drm.h"
#include "parse-util.h"
#include "string-util.h"
enum SessionDeviceNotifications {
SESSION_DEVICE_RESUME,
+3 -7
View File
@@ -2,11 +2,7 @@
#pragma once
#include "list.h"
#include "memory-util.h"
typedef struct Device Device;
typedef struct Session Session;
typedef struct SessionDevice SessionDevice;
#include "logind-forward.h"
typedef enum DeviceType {
DEVICE_TYPE_UNKNOWN,
@@ -15,7 +11,7 @@ typedef enum DeviceType {
DEVICE_TYPE_HIDRAW,
} DeviceType;
struct SessionDevice {
typedef struct SessionDevice {
Session *session;
Device *device;
@@ -27,7 +23,7 @@ struct SessionDevice {
bool pushed_fd:1;
LIST_FIELDS(struct SessionDevice, sd_by_device);
};
} SessionDevice;
int session_device_new(Session *s, dev_t dev, bool open_device, SessionDevice **ret);
SessionDevice *session_device_free(SessionDevice *sd);
+15 -4
View File
@@ -1,6 +1,5 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <fcntl.h>
#include <linux/kd.h>
#include <linux/vt.h>
@@ -9,7 +8,10 @@
#include <sys/stat.h>
#include <unistd.h>
#include "sd-bus.h"
#include "sd-event.h"
#include "sd-messages.h"
#include "sd-varlink.h"
#include "alloc-util.h"
#include "audit-util.h"
@@ -18,12 +20,14 @@
#include "daemon-util.h"
#include "devnum-util.h"
#include "env-file.h"
#include "errno-util.h"
#include "escape.h"
#include "extract-word.h"
#include "fd-util.h"
#include "fileio.h"
#include "format-util.h"
#include "fs-util.h"
#include "io-util.h"
#include "hashmap.h"
#include "login-util.h"
#include "logind.h"
#include "logind-dbus.h"
@@ -41,10 +45,9 @@
#include "process-util.h"
#include "serialize.h"
#include "string-table.h"
#include "strv.h"
#include "terminal-util.h"
#include "tmpfile-util.h"
#include "uid-classification.h"
#include "user-record.h"
#include "user-util.h"
#define RELEASE_USEC (20*USEC_PER_SEC)
@@ -1613,6 +1616,14 @@ int session_send_create_reply(Session *s, const sd_bus_error *error) {
return r;
}
bool session_is_self(const char *name) {
return isempty(name) || streq(name, "self");
}
bool session_is_auto(const char *name) {
return streq_ptr(name, "auto");
}
static const char* const session_state_table[_SESSION_STATE_MAX] = {
[SESSION_OPENING] = "opening",
[SESSION_ONLINE] = "online",
+5 -20
View File
@@ -1,21 +1,11 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "sd-bus.h"
#include "sd-event.h"
#include "sd-varlink.h"
#include "hashmap.h"
#include "list.h"
#include "logind-forward.h"
#include "pidref.h"
#include "string-util.h"
#include "time-util.h"
typedef struct Manager Manager;
typedef struct Seat Seat;
typedef struct Session Session;
typedef struct User User;
typedef enum SessionState {
SESSION_OPENING, /* Session scope is being created */
SESSION_ONLINE, /* Logged in */
@@ -106,7 +96,7 @@ typedef enum TTYValidity {
_TTY_VALIDITY_INVALID = -EINVAL,
} TTYValidity;
struct Session {
typedef struct Session {
Manager *manager;
char *id;
@@ -175,7 +165,7 @@ struct Session {
LIST_FIELDS(Session, sessions_by_seat);
LIST_FIELDS(Session, gc_queue);
};
} Session;
int session_new(Manager *m, const char *id, Session **ret);
Session* session_free(Session *s);
@@ -231,10 +221,5 @@ bool session_job_pending(Session *s);
int session_send_create_reply(Session *s, const sd_bus_error *error);
static inline bool SESSION_IS_SELF(const char *name) {
return isempty(name) || streq(name, "self");
}
static inline bool SESSION_IS_AUTO(const char *name) {
return streq_ptr(name, "auto");
}
bool session_is_self(const char *name);
bool session_is_auto(const char *name);
+6 -2
View File
@@ -1,19 +1,23 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include "sd-bus.h"
#include "alloc-util.h"
#include "bus-get-properties.h"
#include "bus-object.h"
#include "bus-polkit.h"
#include "bus-util.h"
#include "format-util.h"
#include "hashmap.h"
#include "logind.h"
#include "logind-dbus.h"
#include "logind-session.h"
#include "logind-session-dbus.h"
#include "logind-user.h"
#include "logind-user-dbus.h"
#include "signal-util.h"
#include "string-util.h"
#include "strv.h"
#include "user-record.h"
#include "user-util.h"
static int property_get_uid(
+1 -6
View File
@@ -1,12 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "sd-bus.h"
#include "bus-object.h"
#include "macro.h"
typedef struct User User;
#include "logind-forward.h"
extern const BusObjectImplementation user_object;
+6 -5
View File
@@ -1,24 +1,25 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <unistd.h>
#include "sd-bus.h"
#include "sd-event.h"
#include "alloc-util.h"
#include "bus-common-errors.h"
#include "bus-error.h"
#include "bus-locator.h"
#include "bus-util.h"
#include "cgroup-util.h"
#include "clean-ipc.h"
#include "env-file.h"
#include "errno-util.h"
#include "escape.h"
#include "fd-util.h"
#include "fileio.h"
#include "format-util.h"
#include "fs-util.h"
#include "hashmap.h"
#include "label-util.h"
#include "limits-util.h"
#include "logind-session.h"
#include "logind.h"
#include "logind-dbus.h"
#include "logind-seat.h"
@@ -26,17 +27,17 @@
#include "logind-user-dbus.h"
#include "mkdir-label.h"
#include "parse-util.h"
#include "path-util.h"
#include "percent-util.h"
#include "rm-rf.h"
#include "serialize.h"
#include "special.h"
#include "stdio-util.h"
#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "tmpfile-util.h"
#include "uid-classification.h"
#include "unit-name.h"
#include "user-record.h"
#include "user-util.h"
int user_new(Manager *m, UserRecord *ur, User **ret) {
+5 -10
View File
@@ -1,15 +1,10 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "sd-event.h"
#include "conf-parser.h"
#include "forward.h"
#include "list.h"
#include "user-record.h"
typedef struct Manager Manager;
typedef struct Session Session;
typedef struct User User;
#include "logind-forward.h"
#include "time-util.h"
typedef enum UserState {
USER_OFFLINE, /* Not logged in at all */
@@ -29,7 +24,7 @@ typedef enum UserGCMode {
_USER_GC_MODE_INVALID = -EINVAL,
} UserGCMode;
struct User {
typedef struct User {
Manager *manager;
UserRecord *user_record;
@@ -66,7 +61,7 @@ struct User {
LIST_HEAD(Session, sessions);
LIST_FIELDS(User, gc_queue);
};
} User;
int user_new(Manager *m, UserRecord *ur, User **ret);
User *user_free(User *u);
+4
View File
@@ -1,5 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <sys/inotify.h>
#include "sd-event.h"
#include "log.h"
#include "logind.h"
#include "logind-session.h"
+1 -1
View File
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
typedef struct Manager Manager;
#include "logind-forward.h"
int manager_read_utmp(Manager *m);
void manager_connect_utmp(Manager *m);
+7 -4
View File
@@ -1,17 +1,20 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "sd-bus.h"
#include "sd-event.h"
#include "alloc-util.h"
#include "cgroup-util.h"
#include "fd-util.h"
#include "format-util.h"
#include "hashmap.h"
#include "json-util.h"
#include "logind-session.h"
#include "logind.h"
#include "logind-dbus.h"
#include "logind-seat.h"
#include "logind-session-dbus.h"
#include "logind-user.h"
#include "logind-varlink.h"
#include "terminal-util.h"
#include "user-record.h"
#include "user-util.h"
#include "varlink-io.systemd.Login.h"
#include "varlink-io.systemd.service.h"
@@ -78,9 +81,9 @@ static int manager_varlink_get_session_by_name(
/* Resolves a session name to a session object. Supports resolving the special names "self" and "auto". */
if (SESSION_IS_SELF(name))
if (session_is_self(name))
return manager_varlink_get_session_by_peer(m, link, /* consult_display= */ false, ret);
if (SESSION_IS_AUTO(name))
if (session_is_auto(name))
return manager_varlink_get_session_by_peer(m, link, /* consult_display= */ true, ret);
Session *session = hashmap_get(m->sessions, name);
+1 -4
View File
@@ -1,10 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "sd-bus.h"
typedef struct Manager Manager;
typedef struct Session Session;
#include "logind-forward.h"
int manager_varlink_init(Manager *m);
void manager_varlink_done(Manager *m);
+3 -10
View File
@@ -1,22 +1,15 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <unistd.h>
#include <stdio.h>
#include "sd-messages.h"
#include "alloc-util.h"
#include "audit-util.h"
#include "bus-common-errors.h"
#include "bus-error.h"
#include "bus-util.h"
#include "event-util.h"
#include "format-util.h"
#include "log.h"
#include "logind.h"
#include "path-util.h"
#include "special.h"
#include "strv.h"
#include "unit-name.h"
#include "string-util.h"
#include "user-util.h"
#include "wall.h"
+7 -10
View File
@@ -1,46 +1,43 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <fcntl.h>
#include <sys/types.h>
#include <unistd.h>
#include "sd-bus.h"
#include "sd-daemon.h"
#include "sd-device.h"
#include "sd-event.h"
#include "alloc-util.h"
#include "bus-error.h"
#include "bus-locator.h"
#include "bus-log-control-api.h"
#include "bus-polkit.h"
#include "cgroup-util.h"
#include "bus-object.h"
#include "common-signal.h"
#include "constants.h"
#include "daemon-util.h"
#include "device-util.h"
#include "devnum-util.h"
#include "dirent-util.h"
#include "errno-util.h"
#include "escape.h"
#include "fd-util.h"
#include "format-util.h"
#include "fs-util.h"
#include "hashmap.h"
#include "label-util.h"
#include "logind-session.h"
#include "logind.h"
#include "logind-button.h"
#include "logind-dbus.h"
#include "logind-device.h"
#include "logind-seat.h"
#include "logind-seat-dbus.h"
#include "logind-session-dbus.h"
#include "logind-session-device.h"
#include "logind-user.h"
#include "logind-user-dbus.h"
#include "logind-utmp.h"
#include "logind-varlink.h"
#include "main-func.h"
#include "mkdir-label.h"
#include "parse-util.h"
#include "process-util.h"
#include "selinux-util.h"
#include "service-util.h"
#include "signal-util.h"
#include "strv.h"
+1 -17
View File
@@ -1,28 +1,12 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include <sys/stat.h>
#include "sd-bus.h"
#include "sd-device.h"
#include "sd-event.h"
#include "sd-varlink.h"
#include "calendarspec.h"
#include "conf-parser.h"
#include "hashmap.h"
#include "list.h"
#include "logind-action.h"
#include "set.h"
#include "time-util.h"
#include "user-record.h"
typedef struct Button Button;
typedef struct Device Device;
typedef struct Seat Seat;
typedef struct Session Session;
typedef struct User User;
#include "logind-forward.h"
typedef struct Manager {
sd_event *event;
+4 -9
View File
@@ -1,7 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <endian.h>
#include <errno.h>
#include <fcntl.h>
#include <pwd.h>
#include <security/_pam_macros.h>
@@ -10,19 +9,15 @@
#include <security/pam_modules.h>
#include <security/pam_modutil.h>
#include <sys/file.h>
#if HAVE_PIDFD_OPEN
#include <sys/pidfd.h>
#endif
#include "time-util.h"
#include <sys/stat.h>
#include <sys/sysmacros.h>
#include <sys/types.h>
#include <unistd.h>
#include "sd-bus.h"
#include "sd-varlink.h"
#include "alloc-util.h"
#include "audit-util.h"
#include "bus-common-errors.h"
#include "bus-error.h"
#include "bus-internal.h"
@@ -36,7 +31,6 @@
#include "errno-util.h"
#include "extract-word.h"
#include "fd-util.h"
#include "fileio.h"
#include "format-util.h"
#include "fs-util.h"
#include "hostname-util.h"
@@ -44,17 +38,18 @@
#include "json-util.h"
#include "locale-util.h"
#include "login-util.h"
#include "macro.h"
#include "missing_syscall.h"
#include "osc-context.h"
#include "pam-util.h"
#include "parse-util.h"
#include "path-util.h"
#include "percent-util.h"
#include "pidfd-util.h"
#include "pidref.h"
#include "process-util.h"
#include "rlimit-util.h"
#include "socket-util.h"
#include "stdio-util.h"
#include "string-util.h"
#include "strv.h"
#include "terminal-util.h"
#include "tmpfile-util.h"
-3
View File
@@ -1,6 +1,5 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <security/_pam_macros.h>
#include <security/pam_ext.h>
#include <security/pam_misc.h>
@@ -8,8 +7,6 @@
#include <security/pam_modutil.h>
#include "keyring-util.h"
#include "log.h"
#include "macro.h"
#include "missing_syscall.h"
#include "nulstr-util.h"
#include "pam-util.h"
-2
View File
@@ -1,7 +1,5 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include "sd-device.h"
#include "alloc-util.h"
+1 -2
View File
@@ -1,8 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <sys/types.h>
#include "forward.h"
#include "output-mode.h"
int show_sysfs(const char *seat, const char *prefix, unsigned columns, OutputFlags flags);
-2
View File
@@ -6,9 +6,7 @@
#include "sd-bus.h"
#include "bus-locator.h"
#include "bus-util.h"
#include "fd-util.h"
#include "macro.h"
#include "tests.h"
static int inhibit(sd_bus *bus, const char *what) {
-1
View File
@@ -1,7 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "login-util.h"
#include "macro.h"
#include "tests.h"
TEST(session_id_valid) {
+4 -5
View File
@@ -7,16 +7,15 @@
*/
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
#include "sd-bus.h"
#include "alloc-util.h"
#include "argv-util.h"
#include "bus-common-errors.h"
#include "bus-locator.h"
#include "path-util.h"
#include "string-util.h"
#include "terminal-util.h"
#include "tests.h"
#include "time-util.h"
static const char *arg_tty = NULL;
+2 -3
View File
@@ -1,14 +1,13 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <stdint.h>
#include <sys/mount.h>
#include "sd-bus.h"
#include "bus-error.h"
#include "bus-locator.h"
#include "dev-setup.h"
#include "devnum-util.h"
#include "errno-util.h"
#include "fd-util.h"
#include "format-util.h"
#include "fs-util.h"
@@ -24,7 +23,7 @@
#include "path-util.h"
#include "quota-util.h"
#include "rm-rf.h"
#include "selinux-util.h"
#include "set.h"
#include "smack-util.h"
#include "stat-util.h"
#include "stdio-util.h"