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: 1194265 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-107039-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="icGUoSI4"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47CmC930bHz9sPc for ; Thu, 14 Nov 2019 00:47:49 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; q=dns; s=default; b=ZHH N0oCcI7QqPFnrNCoDzaOsIJT1k1s6d67kMAdxcwGbFZMs/4WTnv6S6Pt+4E/rMLU IDsE2AIk1GqkWdvZg0/YFE9x6hgprGk2/U+hFZrVNjRdjN+jwFBroyUGDuiuuHju NIyxCE4HAUEldKCgYfSLoiw3vPlffKdq11WDpZ9o= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; s=default; bh=2WPt7fzaK 7zgUo31Rg3Es+Sh5ew=; b=icGUoSI4IUYhNeziRp0TutV6BHiXYqfE97p79te6t BgELLy7Uh+o/iHCJRLLBaSTtJRpD/hXzGG1Gu6YAP8oiuLQe3+LUwSrVINHB83Ch 2UiJ4BBV5F3WMhpaODMKD//wRN4rOGcHpbFG3R3XUgPszSfUmRWZnpHeevDApcOY Bs= 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)