WindowServer: Make all terminating signals exit cleanly

This allows window server to restore input handling to TTY if window
server crashes on page fault or some other unexpected exception.
This commit is contained in:
Bananymous 2024-11-13 17:32:13 +02:00
parent d19264eea8
commit 5e041e6e5a
1 changed files with 13 additions and 0 deletions

View File

@ -165,6 +165,19 @@ int main()
atexit([]() { tty_ctrl(STDIN_FILENO, TTY_CMD_SET, TTY_FLAG_ENABLE_INPUT); });
constexpr int non_terminating_signals[] {
SIGCHLD,
SIGCONT,
SIGSTOP,
SIGTSTP,
SIGTTIN,
SIGTTOU,
};
for (int sig = _SIGMIN; sig <= _SIGMAX; sig++)
signal(sig, exit);
for (int sig : non_terminating_signals)
signal(sig, SIG_DFL);
MUST(LibInput::KeyboardLayout::initialize());
MUST(LibInput::KeyboardLayout::get().load_from_file("/usr/share/keymaps/us.keymap"_sv));