From patchwork Wed Mar 27 08:52:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 1066743 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-100908-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="QgkIi8SE"; 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 44ThcS2h19z9sSh for ; Wed, 27 Mar 2019 19:53: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=b9lMRt2eoQBTrRsAc15yCQhMw/qicxo KU537xxVhEdKkQ3jE4wLXu1PLXh858jXLn5Oh749lC1qiOfq+DF/RJh5iAS1svV8 kUUZ8erfEcKrsq0JRKKERJ1dkKM4jUlpMzMTM4I/7zAPTlITrnwAz+9tP8TevZRa dRJbrN4m+WrI= 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=TueB9Wu6c7pG25dVCwetGfg8jzE=; b=QgkIi 8SEYM4cg6HIc2B/gpXtC3tmVMh2ycSFHvA4JRIXA2D4zERa/tdhJNPhF+BFQpYmI 0KUTHIRdpnccQNnU4UEPIwgHHG5nRUOvqq5BtOMc5TrfdxuiUyjJf7Z4j2gs0pbz GcsaiPXhWz4qC20ammhK3NfyupNyY5RX1Zl8uo= Received: (qmail 17139 invoked by alias); 27 Mar 2019 08:52:43 -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 17070 invoked by uid 89); 27 Mar 2019 08:52:42 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.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=HX-Languages-Length:1698, 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 5/7] y2038: clock_settime: implementation for Unix generic Date: Wed, 27 Mar 2019 09:52:08 +0100 Message-Id: <20190327085210.22019-6-lukma@denx.de> In-Reply-To: <20190327085210.22019-1-lukma@denx.de> References: <20190327085210.22019-1-lukma@denx.de> * sysdeps/unix/clock_settime (hp_timing_settime): Use __timespec64 in function prototype * sysdeps/unix/clock_settime: Rename __clock_settime to __clock_settime64 * sysdeps/unix/clock_settime: Remove weak_alias for __clock_settime * sysdeps/unix/clock_settime: Add clock_settime when __TIMESIZE != 64 --- sysdeps/unix/clock_settime.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/sysdeps/unix/clock_settime.c b/sysdeps/unix/clock_settime.c index dcf9ff660a..abaac6e293 100644 --- a/sysdeps/unix/clock_settime.c +++ b/sysdeps/unix/clock_settime.c @@ -34,7 +34,7 @@ extern void __pthread_clock_settime (clockid_t clock_id, hp_timing_t offset) static int -hp_timing_settime (clockid_t clock_id, const struct timespec *tp) +hp_timing_settime (clockid_t clock_id, const struct __timespec64 *tp) { hp_timing_t tsc; hp_timing_t usertime; @@ -68,10 +68,9 @@ hp_timing_settime (clockid_t clock_id, const struct timespec *tp) } #endif - /* Set CLOCK to value TP. */ int -__clock_settime (clockid_t clock_id, const struct timespec *tp) +__clock_settime64 (clockid_t clock_id, const struct __timespec64 *tp) { int retval; @@ -108,4 +107,20 @@ __clock_settime (clockid_t clock_id, const struct timespec *tp) return retval; } -weak_alias (__clock_settime, clock_settime) + +#if __TIMESIZE != 64 +int +clock_settime (clockid_t clock_id, const struct timespec *tp) +{ + struct __timespec64 ts64; + + if (! in_time_t_range (tp->tv_sec)) + { + __set_errno (EOVERFLOW); + return -1; + } + + valid_timespec_to_timespec64 (tp, &ts64); + return __clock_settime64 (clock_id, &ts64); +} +#endif