From patchwork Thu Sep 26 13:32: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: 34681 Received: (qmail 57208 invoked by alias); 26 Sep 2019 13:32:46 -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 57194 invoked by uid 89); 26 Sep 2019 13:32:46 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.2 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=soc X-HELO: mail-out.m-online.net From: Lukasz Majewski To: Joseph Myers , Alistair Francis , Alistair Francis , Florian Weimer , Zack Weinberg Cc: Arnd Bergmann , GNU C Library , Adhemerval Zanella , Florian Weimer , Carlos O'Donell , Stepan Golosunov , Lukasz Majewski Subject: [PATCH v9] y2038: Introduce struct __timespec64 - new internal glibc type Date: Thu, 26 Sep 2019 15:32:23 +0200 Message-Id: <20190926133223.5814-1-lukma@denx.de> This type is a glibc's "internal" 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 syscalls between user code and Y2038-proof kernel. To support passing this structure to the kernel - the unnamed 32 bit padding bit-field has been introduced. The placement of it depends on the endianness of the SoC. Tested on x86_64 and ARM. * include/time.h: Add struct __timespec64 definition --- Changes for v9: - Adjust the subject line for the patch - Use unnamed bit-field padding instead of explicit tv_pad Changes for v8: - Replace #if __WORDSIZE == 64 \ || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64) condition with #if __TIMESIZE == 64 to allow usage of struct __timespec64 aliased to timespec on ports supporting 64 bit time API from the outset. Architectures with __TIMESIZE == 32 will use struct __timespec64 with __time64_t tv_sec and __int32_t tv_pad and tv_nsec. Changes for v7: - None Changes for v6: - None Changes for v5: - Reword commit message - Add missing preprocessor condition for x32 (to use timespec instead of __timespec64). Changes for v4: - Change tv_pad's type from named bitfield to 32 bit int Changes for v3: - Replace __TIMESIZE with __WORDSIZE (as architectures with __TIMESIZE==64 will need to use this struct with 32 bit tv_nsec field). - Update in-code comment Changes for v2: - None --- include/time.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/include/time.h b/include/time.h index dcf91855ad..9727786634 100644 --- a/include/time.h +++ b/include/time.h @@ -5,6 +5,7 @@ # include # include # include