summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2015-08-23 11:17:14 +0200
committerAndy Wingo <wingo@pobox.com>2015-08-23 11:17:14 +0200
commit16e56d9f1ae28f17cf360a6daaab668b6cd66e61 (patch)
tree7aa08ddb30fcf6ff31ddc2bdb8a5bf612a76fbca
parentb1d35da9e405abaab2ff540baf2e54087f92e881 (diff)
Remove support for auto-spawning VTs
Auto-spawning VTs requires systemd in practice. If you're using systemd you can just use its logind :)
-rw-r--r--man/logind.conf.xml42
-rw-r--r--src/login/logind-core.c40
-rw-r--r--src/login/logind-dbus.c1
-rw-r--r--src/login/logind-gperf.gperf2
-rw-r--r--src/login/logind-seat.c32
-rw-r--r--src/login/logind.c51
-rw-r--r--src/login/logind.conf2
-rw-r--r--src/login/logind.h6
8 files changed, 0 insertions, 176 deletions
diff --git a/man/logind.conf.xml b/man/logind.conf.xml
index 6d3b355e83..9332e80756 100644
--- a/man/logind.conf.xml
+++ b/man/logind.conf.xml
@@ -74,48 +74,6 @@
<variablelist>
<varlistentry>
- <term><varname>NAutoVTs=</varname></term>
-
- <listitem><para>Takes a positive integer. Configures how many
- virtual terminals (VTs) to allocate by default that, when
- switched to and are previously unused,
- <literal>autovt</literal> services are automatically spawned
- on. These services are instantiated from the template unit
- <filename>autovt@.service</filename> for the respective VT TTY
- name, for example, <filename>autovt@tty4.service</filename>.
- By default, <filename>autovt@.service</filename> is linked to
- <filename>getty@.service</filename>. In other words, login
- prompts are started dynamically as the user switches to unused
- virtual terminals. Hence, this parameter controls how many
- login <literal>gettys</literal> 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
- <varname>ReserveVT=</varname> is always subject to this kind
- of activation, even if it is not one of the VTs configured
- with the <varname>NAutoVTs=</varname> directive. Defaults to
- 6. When set to 0, automatic spawning of
- <literal>autovt</literal> services is
- disabled.</para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term><varname>ReserveVT=</varname></term>
-
- <listitem><para>Takes a positive integer. Identifies one
- virtual terminal that shall unconditionally be reserved for
- <filename>autovt@.service</filename> 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
- <literal>getty</literal> is always available. Defaults to 6
- (in other words, there will always be a
- <literal>getty</literal> available on Alt-F6.). When set to 0,
- VT reservation is disabled.</para></listitem>
- </varlistentry>
-
- <varlistentry>
<term><varname>KillUserProcesses=</varname></term>
<listitem><para>Takes a boolean argument. Configures whether
diff --git a/src/login/logind-core.c b/src/login/logind-core.c
index e8da59a182..ace82fe1e5 100644
--- a/src/login/logind-core.c
+++ b/src/login/logind-core.c
@@ -436,46 +436,6 @@ static int vt_is_busy(unsigned int vtnr) {
return r;
}
-int manager_spawn_autovt(Manager *m, unsigned int vtnr) {
- _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
- char name[sizeof("autovt@tty.service") + DECIMAL_STR_MAX(unsigned int)];
- int r;
-
- assert(m);
- assert(vtnr >= 1);
-
- if (vtnr > m->n_autovts &&
- vtnr != m->reserve_vt)
- return 0;
-
- if (vtnr != m->reserve_vt) {
- /* If this is the reserved TTY, we'll start the getty
- * on it in any case, but otherwise only if it is not
- * busy. */
-
- r = vt_is_busy(vtnr);
- if (r < 0)
- return r;
- else if (r > 0)
- return -EBUSY;
- }
-
- snprintf(name, sizeof(name), "autovt@tty%u.service", vtnr);
- r = sd_bus_call_method(
- m->bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "StartUnit",
- &error,
- NULL,
- "ss", name, "fail");
- if (r < 0)
- log_error("Failed to start %s: %s", name, bus_error_message(&error, r));
-
- return r;
-}
-
bool manager_is_docked(Manager *m) {
Iterator i;
Button *b;
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index b2f53ae017..c5f2faee76 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -1975,7 +1975,6 @@ fail:
const sd_bus_vtable manager_vtable[] = {
SD_BUS_VTABLE_START(0),
- 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 9218d098e0..d9fa06c1f6 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 49808c928b..ead6498200 100644
--- a/src/login/logind-seat.c
+++ b/src/login/logind-seat.c
@@ -176,34 +176,6 @@ static int vt_allocate(unsigned int vtnr) {
return 0;
}
-int seat_preallocate_vts(Seat *s) {
- int r = 0;
- unsigned i;
-
- assert(s);
- assert(s->manager);
-
- log_debug("Preallocating VTs...");
-
- if (s->manager->n_autovts <= 0)
- return 0;
-
- if (!seat_has_vts(s))
- return 0;
-
- for (i = 1; i <= s->manager->n_autovts; i++) {
- int q;
-
- q = vt_allocate(i);
- if (q < 0) {
- log_error_errno(q, "Failed to preallocate VT %u: %m", i);
- r = q;
- }
- }
-
- return r;
-}
-
int seat_apply_acls(Seat *s, Session *old_active) {
int r;
@@ -354,7 +326,6 @@ int seat_active_vt_changed(Seat *s, unsigned int vtnr) {
}
r = seat_set_active(s, new_active);
- manager_spawn_autovt(s->manager, vtnr);
return r;
}
@@ -412,9 +383,6 @@ int seat_start(Seat *s) {
LOG_MESSAGE("New seat %s.", s->id),
NULL);
- /* Initialize VT magic stuff */
- seat_preallocate_vts(s);
-
/* Read current VT */
seat_read_active_vt(s);
diff --git a/src/login/logind.c b/src/login/logind.c
index 9f1b5e3fde..845a229230 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -42,10 +42,7 @@ Manager *manager_new(void) {
return NULL;
m->console_active_fd = -1;
- m->reserve_vt_fd = -1;
- m->n_autovts = 6;
- m->reserve_vt = 6;
m->remove_ipc = true;
m->inhibit_delay_max = 5 * USEC_PER_SEC;
m->handle_power_key = HANDLE_POWEROFF;
@@ -167,8 +164,6 @@ void manager_free(Manager *m) {
sd_bus_unref(m->bus);
sd_event_unref(m->event);
- safe_close(m->reserve_vt_fd);
-
strv_free(m->kill_only_users);
strv_free(m->kill_exclude_users);
@@ -550,29 +545,6 @@ static int manager_dispatch_console(sd_event_source *s, int fd, uint32_t revents
return 0;
}
-static int manager_reserve_vt(Manager *m) {
- _cleanup_free_ char *p = NULL;
-
- assert(m);
-
- if (m->reserve_vt <= 0)
- return 0;
-
- if (asprintf(&p, "/dev/tty%u", m->reserve_vt) < 0)
- return log_oom();
-
- m->reserve_vt_fd = open(p, O_RDWR|O_NOCTTY|O_CLOEXEC|O_NONBLOCK);
- if (m->reserve_vt_fd < 0) {
-
- /* Don't complain on VT-less systems */
- if (errno != ENOENT)
- log_warning_errno(errno, "Failed to pin reserved VT: %m");
- return -errno;
- }
-
- return 0;
-}
-
static int manager_connect_bus(Manager *m) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
int r;
@@ -865,26 +837,6 @@ static int manager_connect_udev(Manager *m) {
return r;
}
- /* Don't bother watching VCSA devices, if nobody cares */
- if (m->n_autovts > 0 && m->console_active_fd >= 0) {
-
- m->udev_vcsa_monitor = udev_monitor_new_from_netlink(m->udev, "udev");
- if (!m->udev_vcsa_monitor)
- return -ENOMEM;
-
- r = udev_monitor_filter_add_match_subsystem_devtype(m->udev_vcsa_monitor, "vc", NULL);
- if (r < 0)
- return r;
-
- r = udev_monitor_enable_receiving(m->udev_vcsa_monitor);
- if (r < 0)
- return r;
-
- r = sd_event_add_io(m->event, &m->udev_vcsa_event_source, udev_monitor_get_fd(m->udev_vcsa_monitor), EPOLLIN, manager_dispatch_vcsa_udev, m);
- if (r < 0)
- return r;
- }
-
return 0;
}
@@ -1062,9 +1014,6 @@ int manager_startup(Manager *m) {
/* Remove stale objects before we start them */
manager_gc(m, false);
- /* Reserve the special reserved VT */
- manager_reserve_vt(m);
-
/* And start everything */
HASHMAP_FOREACH(seat, m->seats, i)
seat_start(seat);
diff --git a/src/login/logind.conf b/src/login/logind.conf
index 6df6f04c77..3775b83105 100644
--- a/src/login/logind.conf
+++ b/src/login/logind.conf
@@ -12,8 +12,6 @@
# See logind.conf(5) for details.
[Login]
-#NAutoVTs=6
-#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
diff --git a/src/login/logind.h b/src/login/logind.h
index 4781688f0a..486278c772 100644
--- a/src/login/logind.h
+++ b/src/login/logind.h
@@ -65,11 +65,6 @@ struct Manager {
int console_active_fd;
- unsigned n_autovts;
-
- unsigned reserve_vt;
- int reserve_vt_fd;
-
Seat *seat0;
char **kill_only_users, **kill_exclude_users;
@@ -140,7 +135,6 @@ int manager_process_button_device(Manager *m, struct udev_device *d);
int manager_startup(Manager *m);
int manager_run(Manager *m);
-int manager_spawn_autovt(Manager *m, unsigned int vtnr);
void manager_gc(Manager *m, bool drop_not_started);