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: 32000 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