From 1172c1e817d26d5f9bb0ec289dd9a71aadf2759c Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Tue, 20 Apr 2021 00:00:22 +0000 Subject: Add portability infrastructure --- src/os/linux-os_kbspecials.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/os/linux-os_kbspecials.c (limited to 'src/os/linux-os_kbspecials.c') diff --git a/src/os/linux-os_kbspecials.c b/src/os/linux-os_kbspecials.c new file mode 100644 index 0000000..0d407ab --- /dev/null +++ b/src/os/linux-os_kbspecials.c @@ -0,0 +1,33 @@ +/* ISC license. */ + +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include "os.h" + +void os_kbspecials (int inns) +{ + int fd ; + if (inns) return ; + fd = open("/dev/tty0", O_RDONLY | O_NOCTTY) ; + if (fd < 0) + strerr_warnwu2sys("open /dev/", "tty0 (kbrequest will not be handled)") ; + else + { + if (ioctl(fd, KDSIGACCEPT, SIGWINCH) < 0) + strerr_warnwu2sys("ioctl KDSIGACCEPT on ", "tty0 (kbrequest will not be handled)") ; + close(fd) ; + } + + sig_block(SIGINT) ; /* don't panic on early cad before s6-svscan catches it */ + if (reboot(RB_DISABLE_CAD) == -1) + strerr_warnwu1sys("trap ctrl-alt-del") ; +} -- cgit v1.3.1