diff options
author | Kenny Levinsen <kl@kl.wtf> | 2020-09-22 01:00:18 +0200 |
---|---|---|
committer | Kenny Levinsen <kl@kl.wtf> | 2020-09-22 01:14:24 +0200 |
commit | be45c480ec0792c7dfb97e39b4f5369b75593ae8 (patch) | |
tree | e7d8a7e18d45269db06b55427a4b7ca5d7d23e19 /common | |
parent | ba4c4226595598f6e3f9712eed6c04c49b7399e5 (diff) | |
download | seatd-be45c480ec0792c7dfb97e39b4f5369b75593ae8.tar.xz |
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.
Diffstat (limited to 'common')
-rw-r--r-- | common/terminal.c | 18 |
1 files changed, 14 insertions, 4 deletions
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; } |