From patchwork Wed Nov 13 13:47:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 35862 Received: (qmail 49453 invoked by alias); 13 Nov 2019 13:47:43 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 49424 invoked by uid 89); 13 Nov 2019 13:47:43 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 spammy=HContent-Transfer-Encoding:8bit X-HELO: mail-out.m-online.net From: Lukasz Majewski To: Joseph Myers , Paul Eggert Cc: Alistair Francis , Alistair Francis , GNU C Library , Adhemerval Zanella , Florian Weimer , Florian Weimer , Zack Weinberg , Carlos O'Donell , Lukasz Majewski Subject: [PATCH] RFC: y2038: linux: Adjust __poll function implementation to use __ppoll64 Date: Wed, 13 Nov 2019 14:47:19 +0100 Message-Id: <20191113134719.21874-1-lukma@denx.de> MIME-Version: 1.0 The __poll implementation (./sysdeps/unix/sysv/linux/poll.c) when the __NR_poll is not defined uses ppoll syscall. Adjust this code to use glibc's internal, Y2038 safe struct __timespec64 and __ppoll64 function. The explicit __ppoll declaration is necessary to allow aliasing of __ppoll64 either via #define or using it directly. By using __ppoll64 instead of __ppoll, systems with TIMESIZE == 32 gain support for 64 bit time (as e.g. glibc's internal struct __timespec64 is used to pass arguments). Reviewed-by: Adhemerval Zanella --- include/sys/poll.h | 9 ++++++--- sysdeps/unix/sysv/linux/poll.c | 6 +++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/sys/poll.h b/include/sys/poll.h index f904e21f89..a599426dc6 100644 --- a/include/sys/poll.h +++ b/include/sys/poll.h @@ -7,12 +7,15 @@ extern int __poll (struct pollfd *__fds, unsigned long int __nfds, libc_hidden_proto (__poll) libc_hidden_proto (ppoll) -# if __TIMESIZE == 64 -# define __ppoll64 __ppoll -# else # include # include +extern int __ppoll (struct pollfd *fds, nfds_t nfds, + const struct timespec *timeout, + const sigset_t *sigmask); +# if __TIMESIZE == 64 +# define __ppoll64 __ppoll +# else extern int __ppoll64 (struct pollfd *fds, nfds_t nfds, const struct __timespec64 *timeout, const sigset_t *sigmask); diff --git a/sysdeps/unix/sysv/linux/poll.c b/sysdeps/unix/sysv/linux/poll.c index 8ea00563a4..588069c898 100644 --- a/sysdeps/unix/sysv/linux/poll.c +++ b/sysdeps/unix/sysv/linux/poll.c @@ -28,8 +28,8 @@ __poll (struct pollfd *fds, nfds_t nfds, int timeout) #ifdef __NR_poll return SYSCALL_CANCEL (poll, fds, nfds, timeout); #else - struct timespec timeout_ts; - struct timespec *timeout_ts_p = NULL; + struct __timespec64 timeout_ts; + struct __timespec64 *timeout_ts_p = NULL; if (timeout >= 0) { @@ -38,7 +38,7 @@ __poll (struct pollfd *fds, nfds_t nfds, int timeout) timeout_ts_p = &timeout_ts; } - return SYSCALL_CANCEL (ppoll, fds, nfds, timeout_ts_p, NULL, 0); + return __ppoll64 (fds, nfds, timeout_ts_p, NULL); #endif } libc_hidden_def (__poll)