From 059696ac014da265ee2d1b062cd0dc7bee3d2001 Mon Sep 17 00:00:00 2001 From: Sven Eden Date: Thu, 26 Jan 2017 10:15:42 +0100 Subject: [PATCH] Remove support for auto-spawning VTs Auto-spawning VTs requires systemd in practice. If you're using systemd you can just use its logind :) --- man/logind.conf.xml | 42 ------------------------------------ src/login/elogind.conf | 2 -- src/login/logind-core.c | 3 +++ src/login/logind-dbus.c | 2 +- src/login/logind-gperf.gperf | 2 -- src/login/logind-seat.c | 10 +++++++++ src/login/logind-seat.h | 2 +- src/login/logind.c | 19 ++++++++++++++++ src/login/logind.h | 5 ++++- 9 files changed, 38 insertions(+), 49 deletions(-) diff --git a/man/logind.conf.xml b/man/logind.conf.xml index 1f7cfc996..9d1f13a5e 100644 --- a/man/logind.conf.xml +++ b/man/logind.conf.xml @@ -69,48 +69,6 @@ - - NAutoVTs= - - Takes a positive integer. Configures how many - virtual terminals (VTs) to allocate by default that, when - switched to and are previously unused, - autovt services are automatically spawned - on. These services are instantiated from the template unit - autovt@.service for the respective VT TTY - name, for example, autovt@tty4.service. - By default, autovt@.service is linked to - getty@.service. In other words, login - prompts are started dynamically as the user switches to unused - virtual terminals. Hence, this parameter controls how many - login gettys are available on the VTs. If a - VT is already used by some other subsystem (for example, a - graphical login), this kind of activation will not be - attempted. Note that the VT configured in - ReserveVT= is always subject to this kind - of activation, even if it is not one of the VTs configured - with the NAutoVTs= directive. Defaults to - 6. When set to 0, automatic spawning of - autovt services is - disabled. - - - - ReserveVT= - - Takes a positive integer. Identifies one - virtual terminal that shall unconditionally be reserved for - autovt@.service activation (see above). - The VT selected with this option will be marked busy - unconditionally, so that no other subsystem will allocate it. - This functionality is useful to ensure that, regardless of how - many VTs are allocated by other subsystems, one login - getty is always available. Defaults to 6 - (in other words, there will always be a - getty available on Alt-F6.). When set to 0, - VT reservation is disabled. - - KillUserProcesses= diff --git a/src/login/elogind.conf b/src/login/elogind.conf index 25edfce6f..85e297dd3 100644 --- a/src/login/elogind.conf +++ b/src/login/elogind.conf @@ -12,8 +12,6 @@ # See elogind.conf(5) for details. [Login] -#NAutoVTs=6 -#ReserveVT=6 #KillUserProcesses=no #KillOnlyUsers= #KillExcludeUsers=root diff --git a/src/login/logind-core.c b/src/login/logind-core.c index 107b3243a..dd681401a 100644 --- a/src/login/logind-core.c +++ b/src/login/logind-core.c @@ -374,6 +374,8 @@ bool manager_shall_kill(Manager *m, const char *user) { return strv_contains(m->kill_only_users, user); } +/// UNNEEDED by elogind +#if 0 static int vt_is_busy(unsigned int vtnr) { struct vt_stat vt_stat; int r = 0; @@ -438,6 +440,7 @@ int manager_spawn_autovt(Manager *m, unsigned int vtnr) { return r; } +#endif // 0 bool manager_is_docked(Manager *m) { Iterator i; diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index 31580af52..a0a23788b 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -2447,7 +2447,7 @@ const sd_bus_vtable manager_vtable[] = { SD_BUS_WRITABLE_PROPERTY("EnableWallMessages", "b", NULL, NULL, offsetof(Manager, enable_wall_messages), 0), SD_BUS_WRITABLE_PROPERTY("WallMessage", "s", NULL, NULL, offsetof(Manager, wall_message), 0), - SD_BUS_PROPERTY("NAutoVTs", "u", NULL, offsetof(Manager, n_autovts), SD_BUS_VTABLE_PROPERTY_CONST), +// SD_BUS_PROPERTY("NAutoVTs", "u", NULL, offsetof(Manager, n_autovts), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("KillOnlyUsers", "as", NULL, offsetof(Manager, kill_only_users), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("KillExcludeUsers", "as", NULL, offsetof(Manager, kill_exclude_users), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("KillUserProcesses", "b", NULL, offsetof(Manager, kill_user_processes), SD_BUS_VTABLE_PROPERTY_CONST), diff --git a/src/login/logind-gperf.gperf b/src/login/logind-gperf.gperf index 9218d098e..d9fa06c1f 100644 --- a/src/login/logind-gperf.gperf +++ b/src/login/logind-gperf.gperf @@ -14,8 +14,6 @@ struct ConfigPerfItem; %struct-type %includes %% -Login.NAutoVTs, config_parse_unsigned, 0, offsetof(Manager, n_autovts) -Login.ReserveVT, config_parse_unsigned, 0, offsetof(Manager, reserve_vt) Login.KillUserProcesses, config_parse_bool, 0, offsetof(Manager, kill_user_processes) Login.KillOnlyUsers, config_parse_strv, 0, offsetof(Manager, kill_only_users) Login.KillExcludeUsers, config_parse_strv, 0, offsetof(Manager, kill_exclude_users) diff --git a/src/login/logind-seat.c b/src/login/logind-seat.c index 8d13a6368..1be871375 100644 --- a/src/login/logind-seat.c +++ b/src/login/logind-seat.c @@ -169,6 +169,8 @@ int seat_load(Seat *s) { return 0; } +/// UNNEEDED by elogind +#if 0 static int vt_allocate(unsigned int vtnr) { char p[sizeof("/dev/tty") + DECIMAL_STR_MAX(unsigned int)]; _cleanup_close_ int fd = -1; @@ -210,6 +212,7 @@ int seat_preallocate_vts(Seat *s) { return r; } +#endif // 0 int seat_apply_acls(Seat *s, Session *old_active) { int r; @@ -361,7 +364,11 @@ int seat_active_vt_changed(Seat *s, unsigned int vtnr) { } r = seat_set_active(s, new_active); + +/// elogind does not spawn autovt +#if 0 manager_spawn_autovt(s->manager, vtnr); +#endif // 0 return r; } @@ -420,7 +427,10 @@ int seat_start(Seat *s) { NULL); /* Initialize VT magic stuff */ +/// elogind does not support autospawning vts +#if 0 seat_preallocate_vts(s); +#endif // 0 /* Read current VT */ seat_read_active_vt(s); diff --git a/src/login/logind-seat.h b/src/login/logind-seat.h index 248dbeb9d..fe13aabfc 100644 --- a/src/login/logind-seat.h +++ b/src/login/logind-seat.h @@ -60,7 +60,7 @@ int seat_switch_to_next(Seat *s); int seat_switch_to_previous(Seat *s); int seat_active_vt_changed(Seat *s, unsigned int vtnr); int seat_read_active_vt(Seat *s); -int seat_preallocate_vts(Seat *s); +// UNNEEDED int seat_preallocate_vts(Seat *s); int seat_attach_session(Seat *s, Session *session); void seat_complete_switch(Seat *s); diff --git a/src/login/logind.c b/src/login/logind.c index 586d92fca..a51f02ebe 100644 --- a/src/login/logind.c +++ b/src/login/logind.c @@ -50,10 +50,14 @@ static Manager *manager_new(void) { m->pin_cgroupfs_fd = -1; m->console_active_fd = -1; + +/// elogind does not support autospawning of vts +#if 0 m->reserve_vt_fd = -1; m->n_autovts = 6; m->reserve_vt = 6; +#endif // 0 m->remove_ipc = true; m->inhibit_delay_max = 5 * USEC_PER_SEC; m->handle_power_key = HANDLE_POWEROFF; @@ -180,7 +184,10 @@ static void manager_free(Manager *m) { sd_bus_unref(m->bus); sd_event_unref(m->event); +/// elogind does not support autospawning of vts +#if 0 safe_close(m->reserve_vt_fd); +#endif // 0 manager_shutdown_cgroup(m, true); @@ -521,6 +528,8 @@ static int manager_dispatch_device_udev(sd_event_source *s, int fd, uint32_t rev return 0; } +/// UNNEEDED by elogind +#if 0 static int manager_dispatch_vcsa_udev(sd_event_source *s, int fd, uint32_t revents, void *userdata) { _cleanup_udev_device_unref_ struct udev_device *d = NULL; Manager *m = userdata; @@ -542,6 +551,7 @@ static int manager_dispatch_vcsa_udev(sd_event_source *s, int fd, uint32_t reven return 0; } +#endif // 0 static int manager_dispatch_button_udev(sd_event_source *s, int fd, uint32_t revents, void *userdata) { _cleanup_udev_device_unref_ struct udev_device *d = NULL; @@ -568,6 +578,8 @@ static int manager_dispatch_console(sd_event_source *s, int fd, uint32_t revents return 0; } +/// UNNEEDED by elogind +#if 0 static int manager_reserve_vt(Manager *m) { _cleanup_free_ char *p = NULL; @@ -590,6 +602,7 @@ static int manager_reserve_vt(Manager *m) { return 0; } +#endif // 0 static int manager_connect_bus(Manager *m) { _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; @@ -871,6 +884,8 @@ static int manager_connect_udev(Manager *m) { } /* Don't bother watching VCSA devices, if nobody cares */ +/// elogind does not support autospawning of vts +#if 0 if (m->n_autovts > 0 && m->console_active_fd >= 0) { m->udev_vcsa_monitor = udev_monitor_new_from_netlink(m->udev, "udev"); @@ -889,6 +904,7 @@ static int manager_connect_udev(Manager *m) { if (r < 0) return r; } +#endif // 0 return 0; } @@ -1068,7 +1084,10 @@ static int manager_startup(Manager *m) { manager_gc(m, false); /* Reserve the special reserved VT */ +/// elogind does not support autospawning of vts +#if 0 manager_reserve_vt(m); +#endif // 0 /* And start everything */ HASHMAP_FOREACH(seat, m->seats, i) diff --git a/src/login/logind.h b/src/login/logind.h index a74a3e483..654744bb4 100644 --- a/src/login/logind.h +++ b/src/login/logind.h @@ -78,10 +78,13 @@ struct Manager { int console_active_fd; +/// elogind does not support autospawning of vts +#if 0 unsigned n_autovts; unsigned reserve_vt; int reserve_vt_fd; +#endif // 0 Seat *seat0; @@ -160,7 +163,7 @@ int manager_add_inhibitor(Manager *m, const char* id, Inhibitor **_inhibitor); int manager_process_seat_device(Manager *m, struct udev_device *d); int manager_process_button_device(Manager *m, struct udev_device *d); -int manager_spawn_autovt(Manager *m, unsigned int vtnr); +// UNNEEDED int manager_spawn_autovt(Manager *m, unsigned int vtnr); bool manager_shall_kill(Manager *m, const char *user); -- 2.30.2