From d403aca70a07e1401cb93738f1af5961582a2e47 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 18 Jul 2016 15:58:42 -0700 Subject: Switch poll() users to xserver_poll() This uses the wrapper in case we need to emulate poll with select as we do on Windows. Reviewed-by: Adam Jackson Signed-off-by: Keith Packard --- hw/dmx/input/lnx-ms.c | 4 ++-- hw/dmx/input/lnx-ps2.c | 4 ++-- hw/kdrive/linux/mouse.c | 6 +++--- hw/kdrive/linux/ms.c | 4 ++-- hw/kdrive/linux/ps2.c | 4 ++-- hw/xfree86/drivers/modesetting/present.c | 4 ++-- hw/xfree86/drivers/modesetting/vblank.c | 1 - hw/xfree86/os-support/shared/posix_tty.c | 8 ++++---- hw/xfree86/os-support/shared/sigio.c | 4 ++-- hw/xfree86/os-support/solaris/sun_bell.c | 4 ++-- 10 files changed, 21 insertions(+), 22 deletions(-) diff --git a/hw/dmx/input/lnx-ms.c b/hw/dmx/input/lnx-ms.c index c7a09cab7..1a5786c7e 100644 --- a/hw/dmx/input/lnx-ms.c +++ b/hw/dmx/input/lnx-ms.c @@ -76,7 +76,7 @@ #include #include #include -#include +#include /*****************************************************************************/ /* Define some macros to make it easier to move this file to another @@ -135,7 +135,7 @@ msLinuxReadBytes(int fd, unsigned char *buf, int len, int min) } if (tot % min == 0) break; - n = poll(&poll_fd, 1, 100); + n = xserver_poll(&poll_fd, 1, 100); if (n <= 0) break; } diff --git a/hw/dmx/input/lnx-ps2.c b/hw/dmx/input/lnx-ps2.c index 00ccc014e..2b6e8d63b 100644 --- a/hw/dmx/input/lnx-ps2.c +++ b/hw/dmx/input/lnx-ps2.c @@ -73,7 +73,7 @@ #include #include #include -#include +#include /*****************************************************************************/ /* Define some macros to make it easier to move this file to another @@ -131,7 +131,7 @@ ps2LinuxReadBytes(int fd, unsigned char *buf, int len, int min) } if (tot % min == 0) break; - n = poll(&poll_fd, 1, 100); + n = xserver_poll(&poll_fd, 1, 100); if (n <= 0) break; } diff --git a/hw/kdrive/linux/mouse.c b/hw/kdrive/linux/mouse.c index 3508b1761..6bdd28651 100644 --- a/hw/kdrive/linux/mouse.c +++ b/hw/kdrive/linux/mouse.c @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include "inputstr.h" #include "scrnintstr.h" #include "kdrive.h" @@ -55,7 +55,7 @@ MouseWaitForReadable(int fd, int timeout) poll_fd.fd = fd; poll_fd.events = POLLIN; for (;;) { - n = poll(&poll_fd, 1, timeout); + n = xserver_poll(&poll_fd, 1, timeout); if (n > 0) return TRUE; if (n < 0 && (errno == EAGAIN || errno == EINTR)) { @@ -136,7 +136,7 @@ MouseWaitForWritable(int fd, int timeout) poll_fd.fd = fd; poll_fd.events = POLLOUT; - n = poll(&poll_fd, 1, timeout); + n = xserver_poll(&poll_fd, 1, timeout); if (n > 0) return TRUE; return FALSE; diff --git a/hw/kdrive/linux/ms.c b/hw/kdrive/linux/ms.c index 79e6373dd..3934682ad 100644 --- a/hw/kdrive/linux/ms.c +++ b/hw/kdrive/linux/ms.c @@ -26,7 +26,7 @@ THE SOFTWARE. #endif #include #include -#include +#include #include #include #include "inputstr.h" @@ -51,7 +51,7 @@ MsReadBytes(int fd, char *buf, int len, int min) } if (tot % min == 0) break; - n = poll(&poll_fd, 1, 100); + n = xserver_poll(&poll_fd, 1, 100); if (n <= 0) break; } diff --git a/hw/kdrive/linux/ps2.c b/hw/kdrive/linux/ps2.c index 5d4a8eb33..4fec02408 100644 --- a/hw/kdrive/linux/ps2.c +++ b/hw/kdrive/linux/ps2.c @@ -25,7 +25,7 @@ #endif #include #include -#include +#include #include "inputstr.h" #include "scrnintstr.h" #include "kdrive.h" @@ -48,7 +48,7 @@ Ps2ReadBytes(int fd, char *buf, int len, int min) } if (tot % min == 0) break; - n = poll(&poll_fd, 1, 100); + n = xserver_poll(&poll_fd, 1, 100); if (n <= 0) break; } diff --git a/hw/xfree86/drivers/modesetting/present.c b/hw/xfree86/drivers/modesetting/present.c index 9a596de75..0093fb512 100644 --- a/hw/xfree86/drivers/modesetting/present.c +++ b/hw/xfree86/drivers/modesetting/present.c @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include @@ -87,7 +87,7 @@ ms_flush_drm_events(ScreenPtr screen) int r; do { - r = poll(&p, 1, 0); + r = xserver_poll(&p, 1, 0); } while (r == -1 && (errno == EINTR || errno == EAGAIN)); /* If there was an error, r will be < 0. Return that. If there was diff --git a/hw/xfree86/drivers/modesetting/vblank.c b/hw/xfree86/drivers/modesetting/vblank.c index 07278871f..d5a9ded35 100644 --- a/hw/xfree86/drivers/modesetting/vblank.c +++ b/hw/xfree86/drivers/modesetting/vblank.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "driver.h" #include "drmmode_display.h" diff --git a/hw/xfree86/os-support/shared/posix_tty.c b/hw/xfree86/os-support/shared/posix_tty.c index d5a70ba3e..6249a625c 100644 --- a/hw/xfree86/os-support/shared/posix_tty.c +++ b/hw/xfree86/os-support/shared/posix_tty.c @@ -57,7 +57,7 @@ #endif #include -#include +#include #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" @@ -395,10 +395,10 @@ xf86WaitForInput(int fd, int timeout) poll_fd.events = POLLIN; if (fd >= 0) { - SYSCALL(r = poll(&poll_fd, 1, timeout)); + SYSCALL(r = xserver_poll(&poll_fd, 1, timeout)); } else { - SYSCALL(r = poll(&poll_fd, 0, timeout)); + SYSCALL(r = xserver_poll(&poll_fd, 0, timeout)); } xf86ErrorFVerb(9, "poll returned %d\n", r); return r; @@ -427,7 +427,7 @@ xf86FlushInput(int fd) poll_fd.fd = fd; poll_fd.events = POLLIN; - while (poll(&poll_fd, 1, 0) > 0) { + while (xserver_poll(&poll_fd, 1, 0) > 0) { if (read(fd, &c, sizeof(c)) < 1) return 0; } diff --git a/hw/xfree86/os-support/shared/sigio.c b/hw/xfree86/os-support/shared/sigio.c index 949d1b477..884a71c61 100644 --- a/hw/xfree86/os-support/shared/sigio.c +++ b/hw/xfree86/os-support/shared/sigio.c @@ -57,7 +57,7 @@ #endif #include -#include +#include #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" @@ -128,7 +128,7 @@ xf86SIGIO(int sig) inSignalContext = TRUE; - SYSCALL(r = poll(xf86SigIOFds, xf86SigIONum, 0)); + SYSCALL(r = xserver_poll(xf86SigIOFds, xf86SigIONum, 0)); for (f = 0; r > 0 && f < xf86SigIONum; f++) { if (xf86SigIOFds[f].revents & POLLIN) { for (i = 0; i < xf86SigIOMax; i++) diff --git a/hw/xfree86/os-support/solaris/sun_bell.c b/hw/xfree86/os-support/solaris/sun_bell.c index beb13d2e9..883728e51 100644 --- a/hw/xfree86/os-support/solaris/sun_bell.c +++ b/hw/xfree86/os-support/solaris/sun_bell.c @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include "xf86.h" #include "xf86Priv.h" @@ -163,7 +163,7 @@ xf86OSRingBell(int loudness, int pitch, int duration) /* sleep a little to allow audio buffer to drain */ naptime = BELL_MS * i; - poll(NULL, 0, naptime); + xserver_poll(NULL, 0, naptime); i = ((sizeof(samples) * iovcnt) - written) % sizeof(samples); iovcnt = 0; -- cgit v1.2.3