[systemd-devel] [PATCH] vconsole: set font on tty16..tty63 as well
Jan Engelhardt
jengelh at inai.de
Tue Feb 24 12:34:35 PST 2015
The setup program would not set the font on tty16 and upwards.
There is a maximum of 63 VCs possible in Linux. (That number is
hardcoded.)
The reason for systemd not having supported tty16+ is because it
used the VT_GETSTATE ioctl, which can only tell about the state
of the first 16 ttys. However,
However, it also seems that we do not need to rely on this
state mask. /dev/vcsN is present if it is active, and is
absent when deallocated -- at least if one is using a dynamically
managed /dev, which I suppose is a requirement of systemd anyway.
---
src/vconsole/vconsole-setup.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
index bf681d9..d43b69f 100644
--- a/src/vconsole/vconsole-setup.c
+++ b/src/vconsole/vconsole-setup.c
@@ -181,20 +181,21 @@ static void font_copy_to_all_vcs(int fd) {
struct unipair unipairs[USHRT_MAX];
int i, r;
- /* get active, and 16 bit mask of used VT numbers */
+ /* get active tty - ignore v_state bitmask */
r = ioctl(fd, VT_GETSTATE, &vcs);
if (r < 0)
return;
- for (i = 1; i <= 15; i++) {
+ for (i = 1; i < 64; ++i) {
char vcname[16];
_cleanup_close_ int vcfd = -1;
struct console_font_op cfo = {};
- if (i == vcs.v_active)
- continue;
-
- /* skip non-allocated ttys */
+ /*
+ * Skip non-allocated ttys. Rather than using the 16-bit-only
+ * vcs.v_state, look at the presence of the device file to
+ * determine whether it is active or not.
+ */
snprintf(vcname, sizeof(vcname), "/dev/vcs%i", i);
if (access(vcname, F_OK) < 0)
continue;
--
2.1.4
More information about the systemd-devel
mailing list