From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 564C2382EBF2; Thu, 30 Jul 2020 13:25:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 564C2382EBF2 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc/azanella/y2038] linux: Add ppoll time64 optimization X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/azanella/y2038 X-Git-Oldrev: 5202dea28d62d9c56e0d29bd455381c49fd0a8e2 X-Git-Newrev: e118ad3ca4f48502ed686fb6ee35c0eccdb21cea Message-Id: <20200730132537.564C2382EBF2@sourceware.org> Date: Thu, 30 Jul 2020 13:25:37 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2020 13:25:37 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=e118ad3ca4f48502ed686fb6ee35c0eccdb21cea commit e118ad3ca4f48502ed686fb6ee35c0eccdb21cea Author: Adhemerval Zanella Date: Fri Jul 10 13:50:56 2020 -0300 linux: Add ppoll time64 optimization It avoid issues the __NR_ppoll_time64 syscall if the kernel does not support it. Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15 kernel). Diff: --- sysdeps/unix/sysv/linux/ppoll.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/sysdeps/unix/sysv/linux/ppoll.c b/sysdeps/unix/sysv/linux/ppoll.c index 079d56b5eb..c4e5b0e733 100644 --- a/sysdeps/unix/sysv/linux/ppoll.c +++ b/sysdeps/unix/sysv/linux/ppoll.c @@ -22,7 +22,7 @@ #include #include #include - +#include int __ppoll64 (struct pollfd *fds, nfds_t nfds, const struct __timespec64 *timeout, @@ -40,13 +40,20 @@ __ppoll64 (struct pollfd *fds, nfds_t nfds, const struct __timespec64 *timeout, #ifndef __NR_ppoll_time64 # define __NR_ppoll_time64 __NR_ppoll #endif - int ret = SYSCALL_CANCEL (ppoll_time64, fds, nfds, timeout, sigmask, + int ret; + + if (supports_time64 ()) + { + ret = SYSCALL_CANCEL (ppoll_time64, fds, nfds, timeout, sigmask, __NSIG_BYTES); -#ifdef __ASSUME_TIME64_SYSCALLS - if (ret >= 0 || errno != ENOSYS) - return ret; + if (ret == 0 || errno != ENOSYS) + return ret; + + mark_time64_unsupported (); + } +#ifndef __ASSUME_TIME64_SYSCALLS struct timespec ts32; if (timeout) {