From c85ef2a6b58ee65d46a647c0c2032a203f2c4194 Mon Sep 17 00:00:00 2001 From: stefan11111 Date: Sun, 6 Jul 2025 16:52:45 +0300 Subject: [PATCH] kdrive: add SIGIO input code The keyboard input driver that will be added to kdrive only works with old SIGIO code, and doesn't work with the new threaded input that kdrive uses. All the code is behind #if's that are never satisfied, so this commit has no functional changes. In preparation for adding the Xfbdev X11 kdrive server. Signed-off-by: stefan11111 --- hw/kdrive/src/kinput.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index 124bfc19b4..784b2f5ab1 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -116,6 +116,45 @@ static void KdSigio(int sig) for (int i = 0; i < kdNumInputFds; i++) (*kdInputFds[i].read) (kdInputFds[i].fd, kdInputFds[i].closure); } + +static void KdBlockSigio(void) +{ + sigset_t set; + + sigemptyset(&set); + sigaddset(&set, SIGIO); + sigprocmask(SIG_BLOCK, &set, 0); +} + +static void KdUnblockSigio(void) +{ + sigset_t set; + + sigemptyset(&set); + sigaddset(&set, SIGIO); + sigprocmask(SIG_UNBLOCK, &set, 0); +} + +#undef VERIFY_SIGIO +#ifdef VERIFY_SIGIO + +void KdAssertSigioBlocked(char *where) +{ + sigset_t set, old; + + sigemptyset(&set); + sigprocmask(SIG_BLOCK, &set, &old); + if (!sigismember(&old, SIGIO)) + ErrorF("SIGIO not blocked at %s\n", where); +} + +#else + +#define KdAssertSigioBlocked(s) + +#endif + +static int kdnFds; #endif #ifdef FNONBLOCK