From patchwork Wed May 15 14:27:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 1100097 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-101997-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="uCD6ooiS"; 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 453xjR2x2Sz9sDn for ; Thu, 16 May 2019 00:27:55 +1000 (AEST) 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:in-reply-to :references; q=dns; s=default; b=pqaG/qeHLtRmfoNMZuR/ZF52DFArPJ1 KQb9oOmjHspD3cRdhlUog718fUiFc16ApXD+it25IDCzF2b226GVjvWTlqzaeB++ pDXcOwe+quM8GnxbKWGkHL6Vz1m4qfw4KfZp6Y1SPpEST5BlftshrCKXDZ+9qP9V nCBhm/3fierw= 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:in-reply-to :references; s=default; bh=5UUs1eEjdDLMoxURETc50CW2m5I=; b=uCD6o oiSMEP20ZYWlD6uVZBaH+zLtGRs+GZnwE863R8Yg9he/LvnKeu7litjlT3wkLcFa fYZKyhjwT5d23MtTmzUtWPRz1FAE4RR+uZdCCP5fvEE/UV4pv3QqjkaenaPYg1MD tGQ9e6Ap4+2Qn6k1KsojqB3pbDp9e6BRaO6VrE= Received: (qmail 54069 invoked by alias); 15 May 2019 14:27:49 -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 54059 invoked by uid 89); 15 May 2019 14:27:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 spammy=51, H*f:sk:2019041, H*r:192.168.8, 5.1 X-HELO: mail-out.m-online.net From: Lukasz Majewski To: libc-alpha@sourceware.org Cc: Stepan Golosunov , Arnd Bergmann , Paul Eggert , Joseph Myers , Lukasz Majewski Subject: [PATCH v5] y2038: Introduce __ASSUME_TIME64_SYSCALLS define Date: Wed, 15 May 2019 16:27:23 +0200 Message-Id: <20190515142723.20182-1-lukma@denx.de> In-Reply-To: <20190414220841.20243-1-lukma@denx.de> References: <20190414220841.20243-1-lukma@denx.de> This define indicates if the Linux kernel (5.1+) provides syscalls supporting 64 bit versions of struct timespec and timeval. For architectures with __WORDSIZE==64 and __TIMESIZE==64 (e.g. x86_64, aarch64) this flag is never defined (as those already use 64 bit versions of struct timespec and timeval). The __ASSUME_TIME64_SYSCALLS shall be only defined on systems with __WORDSIZE==32. For x32 this flag is explicitly undefined as this architecture has __WORDSIZE==32 with __TIMESIZE==64. Despite having __WORDSIZE==32 the x32 has support for 64 bit time values and hence needs to undefine __ASSUME_TIME64_SYSCALLS flag. * sysdeps/unix/sysv/linux/kernel-features.h: (__ASSUME_TIME64_SYSCALLS): [__LINUX_KERNEL_VERSION >= 0x050100]: Define. * sysdeps/unix/sysv/linux/x86_64/kernel-features.h (__ASSUME_TIME64_SYSCALLS): #undef the __ASSUME_TIME64_SYSCALLS for x32 architecture --- Changes for v5: - Rewrite the in-code comment (x32 description more precise) - Change patch description (for x32) Changes for v4: - Exclude this patch from the clock_settime64 patch series - Rewrite the in-code comment - Change patch description Changes for v3: - Provide more detailed and verbose description - Change name to __ASSUME_TIME64_SYSCALLS - Undefine __ASSUME_TIME64_SYSCALLS on x32 Changes for v2: - New patch --- sysdeps/unix/sysv/linux/kernel-features.h | 38 ++++++++++++++++++++++++ sysdeps/unix/sysv/linux/x86_64/kernel-features.h | 7 +++++ 2 files changed, 45 insertions(+) diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h index bc5c959f58..30e77dd213 100644 --- a/sysdeps/unix/sysv/linux/kernel-features.h +++ b/sysdeps/unix/sysv/linux/kernel-features.h @@ -143,3 +143,41 @@ */ #define __ASSUME_CLONE_DEFAULT 1 + +#include +#if __WORDSIZE != 64 +/* Support for Linux kernel syscalls, which are able to handle 64 bit + time on 32 bit systems (with 'long' and __WORDSIZE equal to 32 bits). + + Linux kernel, as of version 5.1, provides following set of syscalls, + which accept data based on struct timespec and timeval with 64 bit + tv_sec: + + clock_gettime64 + clock_settime64 + clock_adjtime64 + clock_getres_time64 + clock_nanosleep_time64 + timer_gettime64 + timer_settime64 + timerfd_gettime64 + timerfd_settime64 + utimensat_time64 + pselect6_time64 + ppoll_time64 + io_pgetevents_time64 + recvmmsg_time64 + mq_timedsend_time64 + mq_timedreceive_time64 + semtimedop_time64 + rt_sigtimedwait_time64 + futex_time64 + sched_rr_get_interval_time64 + + Above syscalls are supposed to replace legacy ones, which handle 32 + bit version of struct timespec and timeval (i.e. without the '64' + suffix). */ +# if __LINUX_KERNEL_VERSION >= 0x050100 +# define __ASSUME_TIME64_SYSCALLS 1 +# endif +#endif diff --git a/sysdeps/unix/sysv/linux/x86_64/kernel-features.h b/sysdeps/unix/sysv/linux/x86_64/kernel-features.h index 26280f57ec..179a9ae932 100644 --- a/sysdeps/unix/sysv/linux/x86_64/kernel-features.h +++ b/sysdeps/unix/sysv/linux/x86_64/kernel-features.h @@ -24,3 +24,10 @@ #endif #include_next + +/* For x32, which is a special case in respect to 64 bit time support + (it has __WORDSIZE==32 but __TIMESIZE==64), the + __ASSUME_TIME64_SYSCALLS flag needs to be explicitly undefined. */ +#ifdef __ILP32__ +# undef __ASSUME_TIME64_SYSCALLS +#endif