From be45c480ec0792c7dfb97e39b4f5369b75593ae8 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Tue, 22 Sep 2020 01:00:18 +0200 Subject: terminal: Ack both release and acquire Linux only requires acking release and ignores ack of acquire, but FreeBSD is more stringent and will patiently wait for both to be acked. Implement proper acking for both events. --- common/terminal.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'common') diff --git a/common/terminal.c b/common/terminal.c index ad54624..7e4088d 100644 --- a/common/terminal.c +++ b/common/terminal.c @@ -199,7 +199,7 @@ int terminal_set_process_switching(int fd, bool enable) { } int terminal_switch_vt(int fd, int vt) { - log_debugf("switching to vt %d", vt); + log_debugf("switching to VT %d", vt); if (ioctl(fd, VT_ACTIVATE, vt) == -1) { log_errorf("could not activate VT: %s", strerror(errno)); return -1; @@ -208,10 +208,20 @@ int terminal_switch_vt(int fd, int vt) { return 0; } -int terminal_ack_switch(int fd) { - log_debug("acking vt switch"); +int terminal_ack_release(int fd) { + log_debug("acking VT release"); + if (ioctl(fd, VT_RELDISP, 1) == -1) { + log_errorf("could not ack VT release: %s", strerror(errno)); + return -1; + } + + return 0; +} + +int terminal_ack_acquire(int fd) { + log_debug("acking VT acquire"); if (ioctl(fd, VT_RELDISP, VT_ACKACQ) == -1) { - log_errorf("could not ack VT switch: %s", strerror(errno)); + log_errorf("could not ack VT acquire: %s", strerror(errno)); return -1; } -- cgit v1.2.3