From patchwork Wed Mar 27 08:52:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 1066737 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-100902-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="O+fweBK8"; 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 44ThbK04WGz9sSh for ; Wed, 27 Mar 2019 19:52:44 +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; q=dns; s=default; b=Gf39JGHTM4SFWSpkrwgwDsh8r+oNOOA 59NnDwa2uhYqDXUTL9+fbqdiWayWn171WuGnxQ/YIT6JuyUEeBxZSstasrfSG/41 eYkDCVKBO/VcET3P62nAlvOjNksEz6AV19MGrnhxNY+xDXmsBqxJ2s+bg7ATu9ET evsEHoylQBeg= 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=tscUOoMGtiuPb/4DtFu/foFCl+U=; b=O+fwe BK82zFFvZ7+11iBIiDQHpWJ8WR9wsPsFlDCSFDO4925V01kd1Q3x6S7LrWl5WhzM /5xevv9Pzt2RouubtQA9IUyV9fyis6x4n/LytPwBqZydw/66H/pT3VaYpyd4+EbW HbzSNZQqHht2MQMdJcyx8FiXAGHy5cwzL45D+A= Received: (qmail 16246 invoked by alias); 27 Mar 2019 08:52:37 -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 16229 invoked by uid 89); 27 Mar 2019 08:52:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-14.8 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=Seconds, half, prevent, H*Ad:D*edu X-HELO: mail-out.m-online.net From: Lukasz Majewski To: libc-alpha@sourceware.org, Joseph Myers Cc: Paul Eggert , Zack Weinberg , Lukasz Majewski Subject: [RFC 1/7] y2038: Introduce struct __timespec64 Date: Wed, 27 Mar 2019 09:52:04 +0100 Message-Id: <20190327085210.22019-2-lukma@denx.de> In-Reply-To: <20190327085210.22019-1-lukma@denx.de> References: <20190327085210.22019-1-lukma@denx.de> This type is a glibc's type similar to struct timespec but whose tv_sec field is a __time64_t rather than a time_t, which makes it Y2038-proof and usable to pass between user code and Y2038-proof kernel syscalls (e.g. clock_gettime()). On 64-bit architectures, and on X32, struct __timespec64 is just an alias of struct timespec, which is already 64-bit. On other architectures, it must be explicitly defined. When passing this structure to the kernel - it ensures that the higher half of tv_nsec is always 0, which means that glibc can reuse the public type (as tv_pad is zeroed anyway). Moreover, the tv_nsec has an anonymous 32 bit padding (ordered according to the endianness of the architecture) to prevent user space programs, depending on long, 32 bit, tv_nsec from breaking. Tested on x86_64 and ARM. * time/bits/types/struct___timespec64.h: Create new file time/bits/types/struct___timespec64.h * include/time.h: Add # include