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