From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 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 dcvr.yhbt.net (Postfix) with ESMTPS id 1220D1F4B5 for ; Thu, 14 Nov 2019 21:03:44 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:cc:references:from:subject:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=aQYmgMBj7nmvLnbl /QEYpDdDXznJ4asj2neZBISxQsq3td+9ekjC4GKn2X9qlFC9d3lHoHgXK8VjAj6+ AIYhimwy65gzpnDExT0iBBuFdcOVNFLpkpS6TVwLGh9tOidxYEA5lKFE3qi3x69A giCRmFjqd8YYTgK8QuXec40cfoo= 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:to:cc:references:from:subject:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=NeeupfnBuA952Ak0t9PmCW ajiMY=; b=EaTc5SDwWs2TdVo2nBHHIIu44TR5NV97i19FYsZo8qu7ky1fqzEtRk ckZJSoKOQ+5GUTh+SPRKaUTNan9ja9dddWjjqmR53NDlS+/Ma+KhxpV67RWOJpsv xLWppX+uTvN+K8CFfE2GcYM4v3/oqEmWW7tsyrxxuB6SXXoK9xRW0= Received: (qmail 108705 invoked by alias); 14 Nov 2019 21:03:41 -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 Received: (qmail 108690 invoked by uid 89); 14 Nov 2019 21:03:40 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mail-qt1-f193.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=to:cc:references:from:openpgp:autocrypt:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=qmluF5kau2dviDtHI5PRNYRmhFFvyyRBU0r2UTybr4o=; b=f8OlgegaUBfx94drlffe2K9SQkAeKROrfMgRGIICtGTEVQyzoblR+jAZMIECiYIP45 laAjvMvwBTy2pF0pOt4QRNJx/SNs/82bR4ESn4YWgJuC0APL9mz0wa8IlJcSClFo+CfA i/fibN6Idata/6uWIcdSvtqgmrmaZ4+cJRMTzhqAN+9XkezxX5V0NYd0H6VUMvE1X6Lo s4BVsjH2x+5KGvzrO0jRaPyPFNmS/sajRvGYupDnq2CYu3MzYAW/1UruunuY3MacZikI kkyNltRcEAcXP7B89F6OZL8+WclXLAH2v236BVC2NA6LVcFcU0Svul90t3Zqv6O1DQ9l 0raw== To: Lukasz Majewski , Joseph Myers , Paul Eggert Cc: Alistair Francis , Alistair Francis , GNU C Library , Florian Weimer , Florian Weimer , Zack Weinberg , Carlos O'Donell References: <20191113134719.21874-1-lukma@denx.de> From: Adhemerval Zanella Openpgp: preference=signencrypt Subject: Re: [PATCH] RFC: y2038: linux: Adjust __poll function implementation to use __ppoll64 Message-ID: Date: Thu, 14 Nov 2019 18:03:31 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20191113134719.21874-1-lukma@denx.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit On 13/11/2019 10:47, Lukasz Majewski wrote: > 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). LGTM. 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) >