From patchwork Thu Sep 7 22:41:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Albert ARIBAUD (3ADEV)" X-Patchwork-Id: 811231 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-84349-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="grtMAKRV"; 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 3xpFwm3xrBz9sDB for ; Fri, 8 Sep 2017 08:48:24 +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=QV3G1bKKNqepD4I5rn4nw9t0eDT3fCA 2q3FuJFURqeDSzJqG/y5Alf8+LFf7Q6bfJEzK1k6djrhJgsklkDQWHQ0SiS5JOoa 2iMr8M4lUbjjj3ZmKZfoTcoEf3URjy6ctvkNMyEZq+AfwHox99h5G18o/V8z49sB 73AL8V8AG77c= 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=qRUp4bMb1kfMNlg/HP2id5VA5Y4=; b=grtMA KRVvJyBaK9lnqqQPREP/zJaxnXZNQw53CLK9FU1c2TWvqjhC06HDQ3zeSn8BBXhM syHNHLINh0IdLUKzu6biEV+eKxpbtrpvW1AolujkKlyMkzKWWiM3RdNqRaEHBmGn GU9WtkRneB+Bany6/GiyodEpkVVI3gy9H5bl4E= Received: (qmail 91517 invoked by alias); 7 Sep 2017 22:44:39 -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 91341 invoked by uid 89); 7 Sep 2017 22:44:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy= X-HELO: smtp6-g21.free.fr From: "Albert ARIBAUD (3ADEV)" To: libc-alpha@sourceware.org Cc: "Albert ARIBAUD (3ADEV)" Subject: [RFC PATCH 31/52] Y2038: add function __gettimeofday_t64 Date: Fri, 8 Sep 2017 00:41:58 +0200 Message-Id: <20170907224219.12483-32-albert.aribaud@3adev.fr> In-Reply-To: <20170907224219.12483-31-albert.aribaud@3adev.fr> References: <20170907224219.12483-1-albert.aribaud@3adev.fr> <20170907224219.12483-2-albert.aribaud@3adev.fr> <20170907224219.12483-3-albert.aribaud@3adev.fr> <20170907224219.12483-4-albert.aribaud@3adev.fr> <20170907224219.12483-5-albert.aribaud@3adev.fr> <20170907224219.12483-6-albert.aribaud@3adev.fr> <20170907224219.12483-7-albert.aribaud@3adev.fr> <20170907224219.12483-8-albert.aribaud@3adev.fr> <20170907224219.12483-9-albert.aribaud@3adev.fr> <20170907224219.12483-10-albert.aribaud@3adev.fr> <20170907224219.12483-11-albert.aribaud@3adev.fr> <20170907224219.12483-12-albert.aribaud@3adev.fr> <20170907224219.12483-13-albert.aribaud@3adev.fr> <20170907224219.12483-14-albert.aribaud@3adev.fr> <20170907224219.12483-15-albert.aribaud@3adev.fr> <20170907224219.12483-16-albert.aribaud@3adev.fr> <20170907224219.12483-17-albert.aribaud@3adev.fr> <20170907224219.12483-18-albert.aribaud@3adev.fr> <20170907224219.12483-19-albert.aribaud@3adev.fr> <20170907224219.12483-20-albert.aribaud@3adev.fr> <20170907224219.12483-21-albert.aribaud@3adev.fr> <20170907224219.12483-22-albert.aribaud@3adev.fr> <20170907224219.12483-23-albert.aribaud@3adev.fr> <20170907224219.12483-24-albert.aribaud@3adev.fr> <20170907224219.12483-25-albert.aribaud@3adev.fr> <20170907224219.12483-26-albert.aribaud@3adev.fr> <20170907224219.12483-27-albert.aribaud@3adev.fr> <20170907224219.12483-28-albert.aribaud@3adev.fr> <20170907224219.12483-29-albert.aribaud@3adev.fr> <20170907224219.12483-30-albert.aribaud@3adev.fr> <20170907224219.12483-31-albert.aribaud@3adev.fr> Implementing a 64-bit settimeofday requires adding a new file to build under time/ and we cannot name that new file 'settimeofday.c' or it will break the 32-bit settimeofday symbol, so we call it 'settimeofday64.c'. Signed-off-by: Albert ARIBAUD (3ADEV) --- sysdeps/unix/sysv/linux/gettimeofday.c | 26 ++++++++++++++++++++++++++ time/Versions | 1 + time/gettimeofday.c | 10 ++++++++++ 3 files changed, 37 insertions(+) diff --git a/sysdeps/unix/sysv/linux/gettimeofday.c b/sysdeps/unix/sysv/linux/gettimeofday.c index 6afa407ac4..5ebbddef4f 100644 --- a/sysdeps/unix/sysv/linux/gettimeofday.c +++ b/sysdeps/unix/sysv/linux/gettimeofday.c @@ -37,3 +37,29 @@ __gettimeofday (struct timeval *tv, struct timezone *tz) libc_hidden_def (__gettimeofday) weak_alias (__gettimeofday, gettimeofday) libc_hidden_weak (gettimeofday) + +/* 64-bit time version */ + +extern int __y2038_linux_support; + +int +__gettimeofday_t64 (struct __timeval64 *tv, struct timezone *tz) +{ + struct timeval tv32; + int result; + + if (__y2038_linux_support) + { + /* TODO: implement using 64-bit time syscall */ + } + + result = INLINE_VSYSCALL (gettimeofday, 2, &tv32, tz); + + if (result == 0) + { + tv->tv_sec = tv32.tv_sec; + tv->tv_usec = tv32.tv_usec; + } + + return result; +} diff --git a/time/Versions b/time/Versions index 3dca51abcb..7daf158a8b 100644 --- a/time/Versions +++ b/time/Versions @@ -73,5 +73,6 @@ libc { __timespec_get64; __time_t64; __stime_t64; + __gettimeofday_t64; } } diff --git a/time/gettimeofday.c b/time/gettimeofday.c index 1d675b6b23..b21d7d4b71 100644 --- a/time/gettimeofday.c +++ b/time/gettimeofday.c @@ -32,3 +32,13 @@ weak_alias (__gettimeofday, gettimeofday) libc_hidden_weak (gettimeofday) stub_warning (gettimeofday) + +/* 64-bit time version */ + +int +__gettimeofday_t64 (struct timeval *tv, struct timezone *tz) +{ + __set_errno (ENOSYS); + return -1; +} +stub_warning (__gettimeofday_t64)