[PATCH v3 3/4] linux: Normalize and return timeout on select (BZ #27651)

Andreas Schwab schwab@linux-m68k.org
Mon Apr 12 08:28:43 GMT 2021


On Apr 09 2021, Adhemerval Zanella via Libc-alpha wrote:

> @@ -52,10 +74,13 @@ __select64 (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
>           (though the pselect() glibc call suppresses this behavior).
>           Since select() on Linux has the same behavior as the pselect6
>           syscall, we update the timeout here.  */
> -      if (r == 0 || errno != ENOSYS)
> +      if (r >= 0 || errno != ENOSYS)
>  	{
>  	  if (timeout != NULL)
> -	    TIMEVAL_TO_TIMESPEC (timeout, &ts64);
> +	    {
> +	      timeout->tv_sec = ts64.tv_sec;
> +	      timeout->tv_usec = ts64.tv_nsec / NSEC_PER_USEC;
> +	    }

What's wrong with TIMESPEC_TO_TIMEVAL?

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


More information about the Libc-alpha mailing list