From patchwork Sat Jan 18 07:20:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 1225112 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-108791-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.a=rsa-sha1 header.s=default header.b=fz2i9GNj; 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 4808W91twDz9sP3 for ; Sat, 18 Jan 2020 18:21:41 +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:in-reply-to :references:mime-version:content-transfer-encoding; q=dns; s= default; b=rh3fY1uzK10zBY1HIxIjSu+YtYP7IRxpaiZ7KHwbkblmdOMpRXnIo xntQp/OfIz7ZG9GNhjmawTKXeiGcY7doTymZpCYDQOoOW1WKDADx3eW3BEGMccNT n7S7891U/th/BsbEM5MA4TmmX3fGs9Yn6gB8zrBVCAqfQndZ2yzkdw= 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:mime-version:content-transfer-encoding; s=default; bh=/sjaoGgqF/rRP/G27lZ5Jicfkno=; b=fz2i9GNjioKGAt5yEFzFD4nJnqkp PZzIfxOL9cg5YGFxOMLe1MAwJYfu/0mnIChw8wV6YTpUFs9svF1yR61O+VUKF3TN 8wSF+0LKtjQJCxzDldWo/jIEbgnSiekoyweI4ThpDo8RFgasdltbfiEYjKuI+8z0 a+HKpPrkemz3X3A= Received: (qmail 58945 invoked by alias); 18 Jan 2020 07:21:20 -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 58889 invoked by uid 89); 18 Jan 2020 07:21:20 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.0 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= X-HELO: mail-out.m-online.net From: Lukasz Majewski To: Joseph Myers , Paul Eggert , Adhemerval Zanella , Samuel Thibault Cc: Alistair Francis , Alistair Francis , GNU C Library , Siddhesh Poyarekar , Florian Weimer , Florian Weimer , Zack Weinberg , Carlos O'Donell , Andreas Schwab , Lukasz Majewski Subject: [PATCH 3/6] y2038: Introduce struct __timeval64 - new internal glibc type Date: Sat, 18 Jan 2020 08:20:44 +0100 Message-Id: <20200118072047.23071-4-lukma@denx.de> In-Reply-To: <20200118072047.23071-1-lukma@denx.de> References: <20200118072047.23071-1-lukma@denx.de> MIME-Version: 1.0 This type is a glibc's "internal" type similar to struct timeval but whose tv_sec field is a __time64_t rather than a time_t, which makes it Y2038-proof. This struct is NOT supposed to be passed to the kernel - instead it shall be converted to struct __timespec64 and clock_[sg]ettime syscalls shall be used (which are now Y2038 safe). Build tests: ./src/scripts/build-many-glibcs.py glibcs Reviewed-by: Alistair Francis --- include/time.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/time.h b/include/time.h index 047f431a1a..22ecacd0d8 100644 --- a/include/time.h +++ b/include/time.h @@ -93,6 +93,20 @@ struct __itimerspec64 }; #endif +#if __TIMESIZE == 64 +# define __timeval64 timeval +#else +/* The glibc Y2038-proof struct __timeval64 structure for a time value. + This structure is NOT supposed to be passed to the Linux kernel. + Instead, it shall be converted to struct __timespec64 and time shall + be [sg]et via clock_[sg]ettime (which are now Y2038 safe). */ +struct __timeval64 +{ + __time64_t tv_sec; /* Seconds */ + __suseconds_t tv_usec; /* Microseconds */ +}; +#endif + #if __TIMESIZE == 64 # define __ctime64 ctime #else