diff options
author | Keith Packard <keithp@keithp.com> | 2015-12-08 14:39:46 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2016-05-26 16:07:54 -0700 |
commit | 6a5a4e60373c1386b311b2a8bb666c32d68a9d99 (patch) | |
tree | 1643ea974c60cefb7dbd6d646e40d77263babaa3 /hw/xfree86/os-support | |
parent | 8cf832c288dec13cbf3c25478a8ccef52d61f3db (diff) |
Remove SIGIO support for input [v5]
This removes all of the SIGIO handling support used for input
throughout the X server, preparing the way for using threads for input
handling instead.
Places calling OsBlockSIGIO and OsReleaseSIGIO are marked with calls
to stub functions input_lock/input_unlock so that we don't lose this
information.
xfree86 SIGIO support is reworked to use internal versions of
OsBlockSIGIO and OsReleaseSIGIO.
v2: Don't change locking order (Peter Hutterer)
v3: Comment weird && FALSE in xf86Helper.c
Leave errno save/restore in xf86ReadInput
Squash with stub adding patch (Peter Hutterer)
v4: Leave UseSIGIO config parameter so that
existing config files don't break (Peter Hutterer)
v5: Split a couple of independent patch bits out
of kinput.c (Peter Hutterer)
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'hw/xfree86/os-support')
-rw-r--r-- | hw/xfree86/os-support/shared/sigio.c | 57 | ||||
-rw-r--r-- | hw/xfree86/os-support/shared/sigiostubs.c | 23 | ||||
-rw-r--r-- | hw/xfree86/os-support/xf86_OSproc.h | 4 |
3 files changed, 23 insertions, 61 deletions
diff --git a/hw/xfree86/os-support/shared/sigio.c b/hw/xfree86/os-support/shared/sigio.c index c746d02fc..e0cd7a89c 100644 --- a/hw/xfree86/os-support/shared/sigio.c +++ b/hw/xfree86/os-support/shared/sigio.c @@ -130,6 +130,26 @@ xf86IsPipe(int fd) return S_ISFIFO(buf.st_mode); } +static void +xf86BlockSIGIO(void) +{ + sigset_t set; + + sigemptyset(&set); + sigaddset(&set, SIGIO); + sigprocmask(SIG_BLOCK, &set, NULL); +} + +static void +xf86ReleaseSIGIO(void) +{ + sigset_t set; + + sigemptyset(&set); + sigaddset(&set, SIGIO); + sigprocmask(SIG_UNBLOCK, &set, NULL); +} + int xf86InstallSIGIOHandler(int fd, void (*f) (int, void *), void *closure) { @@ -145,7 +165,7 @@ xf86InstallSIGIOHandler(int fd, void (*f) (int, void *), void *closure) if (!xf86SigIOFuncs[i].f) { if (xf86IsPipe(fd)) return 0; - OsBlockSIGIO(); + xf86BlockSIGIO(); #ifdef O_ASYNC if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_ASYNC) == -1) { xf86Msg(X_WARNING, "fcntl(%d, O_ASYNC): %s\n", @@ -173,7 +193,7 @@ xf86InstallSIGIOHandler(int fd, void (*f) (int, void *), void *closure) } #endif if (!installed) { - OsReleaseSIGIO(); + xf86ReleaseSIGIO(); return 0; } sigemptyset(&sa.sa_mask); @@ -189,7 +209,7 @@ xf86InstallSIGIOHandler(int fd, void (*f) (int, void *), void *closure) if (fd >= xf86SigIOMaxFd) xf86SigIOMaxFd = fd + 1; FD_SET(fd, &xf86SigIOMask); - OsReleaseSIGIO(); + xf86ReleaseSIGIO(); return 1; } /* Allow overwriting of the closure and callback */ @@ -258,34 +278,3 @@ xf86RemoveSIGIOHandler(int fd) } return ret; } - -int -xf86BlockSIGIO(void) -{ - return OsBlockSIGIO(); -} - -void -xf86UnblockSIGIO(int wasset) -{ - OsReleaseSIGIO(); -} - -void -xf86AssertBlockedSIGIO(char *where) -{ - sigset_t set, old; - - sigemptyset(&set); - sigprocmask(SIG_BLOCK, &set, &old); - if (!sigismember(&old, SIGIO)) - xf86Msg(X_ERROR, "SIGIO not blocked at %s\n", where); -} - -/* XXX This is a quick hack for the benefit of xf86SetSilkenMouse() */ - -int -xf86SIGIOSupported(void) -{ - return 1; -} diff --git a/hw/xfree86/os-support/shared/sigiostubs.c b/hw/xfree86/os-support/shared/sigiostubs.c index ba8e234f4..d1792e8ac 100644 --- a/hw/xfree86/os-support/shared/sigiostubs.c +++ b/hw/xfree86/os-support/shared/sigiostubs.c @@ -45,26 +45,3 @@ xf86RemoveSIGIOHandler(int fd) { return 0; } - -int -xf86BlockSIGIO(void) -{ - return 0; -} - -void -xf86UnblockSIGIO(int wasset) -{ -} - -void -xf86AssertBlockedSIGIO(char *where) -{ -} - -/* XXX This is a quick hack for the benefit of xf86SetSilkenMouse() */ -Bool -xf86SIGIOSupported() -{ - return FALSE; -} diff --git a/hw/xfree86/os-support/xf86_OSproc.h b/hw/xfree86/os-support/xf86_OSproc.h index fa3ff0ee3..99ca90249 100644 --- a/hw/xfree86/os-support/xf86_OSproc.h +++ b/hw/xfree86/os-support/xf86_OSproc.h @@ -169,10 +169,6 @@ extern _X_EXPORT Bool xf86GARTCloseScreen(int screenNum); extern _X_EXPORT int xf86InstallSIGIOHandler(int fd, void (*f) (int, void *), void *); extern _X_EXPORT int xf86RemoveSIGIOHandler(int fd); -extern _X_EXPORT int xf86BlockSIGIO(void); -extern _X_EXPORT void xf86UnblockSIGIO(int); -extern _X_EXPORT void xf86AssertBlockedSIGIO(char *); -extern _X_EXPORT Bool xf86SIGIOSupported(void); #ifdef XF86_OS_PRIVS typedef void (*PMClose) (void); |