[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-xorg-devel
Subject:    Re: [PATCH xserver] xfree86: Fix interpretation of xf86WaitForInput timeout
From:       Peter Hutterer <peter.hutterer () who-t ! net>
Date:       2017-05-29 3:58:33
Message-ID: 20170529035833.GA12425 () jelly
[Download RAW message or body]

On Fri, May 26, 2017 at 02:27:19PM -0700, Jason Gerecke wrote:
> Commit aa6717ce2 switched xf86WaitForInput from using select(2) to using
> poll(2). Before this change, the timeout was interpreted as being in
> microseconds; afterwards it is fed directly to xorg_poll which interprets
> it as being in milliseconds. This results in the function potentially
> blocking 1000x longer than intended. This commit scales down the timeout
> argument before passing it to xorg_poll, being careful to ensure the result
> is not rounded down due to integer division.
> 
> Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>

makes sense. pushed, thanks!

To git+ssh://git.freedesktop.org/git/xorg/xserver
   933d80ba9..2fbf62b2f  master -> master

Cheers,
   Peter
> ---
>  hw/xfree86/os-support/shared/posix_tty.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/hw/xfree86/os-support/shared/posix_tty.c b/hw/xfree86/os-support/shared/posix_tty.c
> index 6249a625c..4c4936c14 100644
> --- a/hw/xfree86/os-support/shared/posix_tty.c
> +++ b/hw/xfree86/os-support/shared/posix_tty.c
> @@ -394,6 +394,9 @@ xf86WaitForInput(int fd, int timeout)
>      poll_fd.fd = fd;
>      poll_fd.events = POLLIN;
>  
> +    /* convert microseconds to milliseconds */
> +    timeout = (timeout + 999) / 1000;
> +
>      if (fd >= 0) {
>          SYSCALL(r = xserver_poll(&poll_fd, 1, timeout));
>      }
> -- 
> 2.13.0
> 
> _______________________________________________
> xorg-devel@lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel
> 
_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic