From patchwork Mon Jun 1 14:07:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 39393 X-Patchwork-Delegate: l.majewski@majess.pl Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B8EE03851C17; Mon, 1 Jun 2020 14:08:02 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-out.m-online.net (mail-out.m-online.net [IPv6:2001:a60:0:28:0:1:25:1]) by sourceware.org (Postfix) with ESMTPS id C3BE63851C17 for ; Mon, 1 Jun 2020 14:08:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C3BE63851C17 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=lukma@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 49bH7d0pNXz1rwb8; Mon, 1 Jun 2020 16:07:56 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 49bH7c4S7xz1qwwf; Mon, 1 Jun 2020 16:07:56 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id knB59pIvLi8y; Mon, 1 Jun 2020 16:07:55 +0200 (CEST) X-Auth-Info: z1uLtF6zC33h9nPHw75jDPs3162UruCbfn9xRJWg9eE= Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Mon, 1 Jun 2020 16:07:54 +0200 (CEST) From: Lukasz Majewski To: Joseph Myers , Paul Eggert , Adhemerval Zanella Subject: [RFC 01/12] doc: Fix wording and formattine in ./support/README Date: Mon, 1 Jun 2020 16:07:29 +0200 Message-Id: <20200601140740.16371-2-lukma@denx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200601140740.16371-1-lukma@denx.de> References: <20200601140740.16371-1-lukma@denx.de> MIME-Version: 1.0 X-Spam-Status: No, score=-21.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Florian Weimer , GNU C Library , Andreas Schwab , Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" --- support/README | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/support/README b/support/README index ae2c41caa8..bbd3d588f2 100644 --- a/support/README +++ b/support/README @@ -4,8 +4,8 @@ not) and tests. # Error-checking wrappers -These wrappers test for error return codes an terminate the process on -error. They are declared in these header files: +These wrappers test for error return codes and terminate the process on +error. They are declared in these header files: * support.h * xsignal.h From patchwork Mon Jun 1 14:07:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 39394 X-Patchwork-Delegate: l.majewski@majess.pl Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 18CC5383E800; Mon, 1 Jun 2020 14:08:03 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.10]) by sourceware.org (Postfix) with ESMTPS id 39CD838708E6 for ; Mon, 1 Jun 2020 14:08:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 39CD838708E6 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=lukma@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 49bH7f59D0z1rwbB; Mon, 1 Jun 2020 16:07:58 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 49bH7f3fCNz1qwwd; Mon, 1 Jun 2020 16:07:58 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id eUsplgwtoPMm; Mon, 1 Jun 2020 16:07:56 +0200 (CEST) X-Auth-Info: HQKwYkGilapDvtGRZgMHE/jN+RnbBckTwBPTjVSb+Os= Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Mon, 1 Jun 2020 16:07:56 +0200 (CEST) From: Lukasz Majewski To: Joseph Myers , Paul Eggert , Adhemerval Zanella Subject: [RFC 02/12] y2038: Rename timespec_compare to __timespec_compare Date: Mon, 1 Jun 2020 16:07:30 +0200 Message-Id: <20200601140740.16371-3-lukma@denx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200601140740.16371-1-lukma@denx.de> References: <20200601140740.16371-1-lukma@denx.de> MIME-Version: 1.0 X-Spam-Status: No, score=-21.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Florian Weimer , GNU C Library , Andreas Schwab , Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" As the timespec_compare is used locally in glibc, its name shall begin with "__". This change adds this prefix. Tested with glibc/glibc-many-build --keep failed glibcs --- sysdeps/pthread/posix-timer.h | 2 +- sysdeps/pthread/timer_gettime.c | 2 +- sysdeps/pthread/timer_routines.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sysdeps/pthread/posix-timer.h b/sysdeps/pthread/posix-timer.h index 81fc8a2394..7d9207e23d 100644 --- a/sysdeps/pthread/posix-timer.h +++ b/sysdeps/pthread/posix-timer.h @@ -115,7 +115,7 @@ timer_delref (struct timer_node *timer) /* Timespec helper routines. */ static inline int __attribute ((always_inline)) -timespec_compare (const struct timespec *left, const struct timespec *right) +__timespec_compare (const struct timespec *left, const struct timespec *right) { if (left->tv_sec < right->tv_sec) return -1; diff --git a/sysdeps/pthread/timer_gettime.c b/sysdeps/pthread/timer_gettime.c index 5723e5f818..6cbf87f434 100644 --- a/sysdeps/pthread/timer_gettime.c +++ b/sysdeps/pthread/timer_gettime.c @@ -51,7 +51,7 @@ timer_gettime (timer_t timerid, struct itimerspec *value) if (armed) { __clock_gettime (clock, &now); - if (timespec_compare (&now, &expiry) < 0) + if (__timespec_compare (&now, &expiry) < 0) timespec_sub (&value->it_value, &expiry, &now); else { diff --git a/sysdeps/pthread/timer_routines.c b/sysdeps/pthread/timer_routines.c index 05e83d7d52..be9b09a832 100644 --- a/sysdeps/pthread/timer_routines.c +++ b/sysdeps/pthread/timer_routines.c @@ -383,7 +383,7 @@ thread_func (void *arg) /* If the timer is due or overdue, remove it from the queue. If it's a periodic timer, re-compute its new time and requeue it. Either way, perform the timer expiry. */ - if (timespec_compare (&now, &timer->expirytime) < 0) + if (__timespec_compare (&now, &timer->expirytime) < 0) break; list_unlink_ip (first); @@ -394,7 +394,7 @@ thread_func (void *arg) timer->overrun_count = 0; timespec_add (&timer->expirytime, &timer->expirytime, &timer->value.it_interval); - while (timespec_compare (&timer->expirytime, &now) < 0) + while (__timespec_compare (&timer->expirytime, &now) < 0) { timespec_add (&timer->expirytime, &timer->expirytime, &timer->value.it_interval); @@ -447,7 +447,7 @@ __timer_thread_queue_timer (struct thread_node *thread, { struct timer_node *timer = timer_links2ptr (iter); - if (timespec_compare (&insert->expirytime, &timer->expirytime) < 0) + if (__timespec_compare (&insert->expirytime, &timer->expirytime) < 0) break; athead = 0; } From patchwork Mon Jun 1 14:07:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 39395 X-Patchwork-Delegate: l.majewski@majess.pl Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 741E0388A82B; Mon, 1 Jun 2020 14:08:05 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by sourceware.org (Postfix) with ESMTPS id C1944383F842 for ; Mon, 1 Jun 2020 14:08:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C1944383F842 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=lukma@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 49bH7h6Hjnz1qsbM; Mon, 1 Jun 2020 16:08:00 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 49bH7h5ylwz1qwwd; Mon, 1 Jun 2020 16:08:00 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id D3MfqDxIdfEM; Mon, 1 Jun 2020 16:07:58 +0200 (CEST) X-Auth-Info: as4n0riDIsEwsUZ9KYot+VxslfxgxgAbAjcpos9tBdM= Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Mon, 1 Jun 2020 16:07:58 +0200 (CEST) From: Lukasz Majewski To: Joseph Myers , Paul Eggert , Adhemerval Zanella Subject: [RFC 03/12] y2038: Rename make_timespec to __make_timespec Date: Mon, 1 Jun 2020 16:07:31 +0200 Message-Id: <20200601140740.16371-4-lukma@denx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200601140740.16371-1-lukma@denx.de> References: <20200601140740.16371-1-lukma@denx.de> MIME-Version: 1.0 X-Spam-Status: No, score=-21.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Florian Weimer , GNU C Library , Andreas Schwab , Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" As the make_timespec is used locally in glibc, its name shall begin with "__". This change adds this prefix. Tested with glibc/glibc-many-build --keep failed glibcs --- nptl/tst-eintr2.c | 2 +- nptl/tst-eintr5.c | 2 +- nptl/tst-rwlock6.c | 2 +- nptl/tst-rwlock7.c | 2 +- nptl/tst-sem17.c | 2 +- nptl/tst-sem5.c | 2 +- support/timespec-add.c | 2 +- support/timespec-sub.c | 2 +- support/timespec.h | 2 +- sysdeps/pthread/tst-cond26.c | 2 +- sysdeps/pthread/tst-cond27.c | 2 +- sysdeps/pthread/tst-join14.c | 2 +- sysdeps/pthread/tst-join3.c | 4 ++-- sysdeps/pthread/tst-join5.c | 6 +++--- sysdeps/pthread/tst-mutex5.c | 6 +++--- sysdeps/pthread/tst-mutex9.c | 2 +- 16 files changed, 21 insertions(+), 21 deletions(-) diff --git a/nptl/tst-eintr2.c b/nptl/tst-eintr2.c index 4f26ccad04..eba8065236 100644 --- a/nptl/tst-eintr2.c +++ b/nptl/tst-eintr2.c @@ -38,7 +38,7 @@ static void * tf1 (void *arg) { struct timespec ts = timespec_add (xclock_now (CLOCK_REALTIME), - make_timespec (10000, 0)); + __make_timespec (10000, 0)); /* This call must never return. */ int e = pthread_mutex_timedlock (&m1, &ts); diff --git a/nptl/tst-eintr5.c b/nptl/tst-eintr5.c index bc6c0fef53..4edfbaaef6 100644 --- a/nptl/tst-eintr5.c +++ b/nptl/tst-eintr5.c @@ -39,7 +39,7 @@ static void * tf (void *arg) { struct timespec ts = timespec_add (xclock_now (CLOCK_REALTIME), - make_timespec (10000, 0)); + __make_timespec (10000, 0)); /* This call must never return. */ TEST_COMPARE (pthread_cond_timedwait (&c, &m, &ts), 0); diff --git a/nptl/tst-rwlock6.c b/nptl/tst-rwlock6.c index 36afa22da4..8714381a16 100644 --- a/nptl/tst-rwlock6.c +++ b/nptl/tst-rwlock6.c @@ -63,7 +63,7 @@ tf (void *arg) xclock_gettime (clockid_for_get, &ts_start); struct timespec ts_timeout = timespec_add (ts_start, - make_timespec (0, 300000000)); + __make_timespec (0, 300000000)); verbose_printf ("child calling %srdlock\n", fnname); diff --git a/nptl/tst-rwlock7.c b/nptl/tst-rwlock7.c index 1dcc4f0425..bdbfb5dac9 100644 --- a/nptl/tst-rwlock7.c +++ b/nptl/tst-rwlock7.c @@ -61,7 +61,7 @@ tf (void *arg) struct timespec ts_start; xclock_gettime (clockid_for_get, &ts_start); const struct timespec ts_timeout = timespec_add (ts_start, - make_timespec (0, 300000000)); + __make_timespec (0, 300000000)); if (clockid == CLOCK_USE_TIMEDLOCK) TEST_COMPARE (pthread_rwlock_timedwrlock (r, &ts_timeout), ETIMEDOUT); diff --git a/nptl/tst-sem17.c b/nptl/tst-sem17.c index 80658b85c7..090e390507 100644 --- a/nptl/tst-sem17.c +++ b/nptl/tst-sem17.c @@ -35,7 +35,7 @@ do_test (void) sem_t s; TEST_COMPARE (sem_init (&s, 0, 1), 0); - const struct timespec ts = make_timespec (0, 0); + const struct timespec ts = __make_timespec (0, 0); /* These clocks are meaningless to sem_clockwait. */ #if defined(CLOCK_PROCESS_CPUTIME_ID) diff --git a/nptl/tst-sem5.c b/nptl/tst-sem5.c index 766274e50d..8f5c5b9bb1 100644 --- a/nptl/tst-sem5.c +++ b/nptl/tst-sem5.c @@ -42,7 +42,7 @@ do_test_clock (clockid_t clockid) /* We wait for half a second. */ xclock_gettime (clockid_for_get, &ts); - ts = timespec_add (ts, make_timespec (0, TIMESPEC_HZ/2)); + ts = timespec_add (ts, __make_timespec (0, TIMESPEC_HZ/2)); errno = 0; TEST_COMPARE (TEMP_FAILURE_RETRY ((clockid == CLOCK_USE_TIMEDWAIT) diff --git a/support/timespec-add.c b/support/timespec-add.c index 57bf6682e1..bb22b12e9b 100644 --- a/support/timespec-add.c +++ b/support/timespec-add.c @@ -61,5 +61,5 @@ timespec_add (struct timespec a, struct timespec b) } } - return make_timespec (rs, rns); + return __make_timespec (rs, rns); } diff --git a/support/timespec-sub.c b/support/timespec-sub.c index a1d1a8df92..535a3b155b 100644 --- a/support/timespec-sub.c +++ b/support/timespec-sub.c @@ -61,5 +61,5 @@ timespec_sub (struct timespec a, struct timespec b) } } - return make_timespec (rs, rns); + return __make_timespec (rs, rns); } diff --git a/support/timespec.h b/support/timespec.h index c5852dfe75..dbe12938d8 100644 --- a/support/timespec.h +++ b/support/timespec.h @@ -30,7 +30,7 @@ struct timespec timespec_sub (struct timespec, struct timespec) __attribute__((const)); static inline struct timespec -make_timespec (time_t s, long int ns) +__make_timespec (time_t s, long int ns) { struct timespec r; r.tv_sec = s; diff --git a/sysdeps/pthread/tst-cond26.c b/sysdeps/pthread/tst-cond26.c index e647da00c2..5caf7aaaa7 100644 --- a/sysdeps/pthread/tst-cond26.c +++ b/sysdeps/pthread/tst-cond26.c @@ -36,7 +36,7 @@ do_test (void) { xpthread_mutex_lock (&mut); - const struct timespec ts = make_timespec (0, 0); + const struct timespec ts = __make_timespec (0, 0); /* These clocks are meaningless to sem_clockwait. */ #if defined(CLOCK_PROCESS_CPUTIME_ID) diff --git a/sysdeps/pthread/tst-cond27.c b/sysdeps/pthread/tst-cond27.c index c8142abf9e..3d7b8240b1 100644 --- a/sysdeps/pthread/tst-cond27.c +++ b/sysdeps/pthread/tst-cond27.c @@ -42,7 +42,7 @@ do_test_clock (clockid_t clockid) /* Waiting for the condition will fail. But we want the timeout here. */ const struct timespec ts_now = xclock_now (clockid); const struct timespec ts_timeout = - timespec_add (ts_now, make_timespec (0, 500000000)); + timespec_add (ts_now, __make_timespec (0, 500000000)); /* In theory pthread_cond_clockwait could return zero here due to spurious wakeup. However that can't happen without a signal or an diff --git a/sysdeps/pthread/tst-join14.c b/sysdeps/pthread/tst-join14.c index 0109324453..092f454449 100644 --- a/sysdeps/pthread/tst-join14.c +++ b/sysdeps/pthread/tst-join14.c @@ -34,7 +34,7 @@ static void * tf (void *arg) { - struct timespec ts = make_timespec(0, 100000); + struct timespec ts = __make_timespec(0, 100000); nanosleep(&ts, NULL); return (void *) 42l; diff --git a/sysdeps/pthread/tst-join3.c b/sysdeps/pthread/tst-join3.c index ffebcf586f..fc54f12cc9 100644 --- a/sysdeps/pthread/tst-join3.c +++ b/sysdeps/pthread/tst-join3.c @@ -54,7 +54,7 @@ do_test_clock (clockid_t clockid) void *status; struct timespec timeout = timespec_add (xclock_now (clockid_for_get), - make_timespec (0, 200000000)); + __make_timespec (0, 200000000)); int val; if (clockid == CLOCK_USE_TIMEDJOIN) @@ -69,7 +69,7 @@ do_test_clock (clockid_t clockid) while (1) { timeout = timespec_add (xclock_now (clockid_for_get), - make_timespec (0, 200000000)); + __make_timespec (0, 200000000)); if (clockid == CLOCK_USE_TIMEDJOIN) val = pthread_timedjoin_np (th, &status, &timeout); diff --git a/sysdeps/pthread/tst-join5.c b/sysdeps/pthread/tst-join5.c index acdc365c05..525f349a4b 100644 --- a/sysdeps/pthread/tst-join5.c +++ b/sysdeps/pthread/tst-join5.c @@ -46,15 +46,15 @@ thread_join (pthread_t thread, void **retval) { #if defined USE_PTHREAD_TIMEDJOIN_NP const struct timespec ts = timespec_add (xclock_now (CLOCK_REALTIME), - make_timespec (1000, 0)); + __make_timespec (1000, 0)); return pthread_timedjoin_np (thread, retval, &ts); #elif defined USE_PTHREAD_CLOCKJOIN_NP_REALTIME const struct timespec ts = timespec_add (xclock_now (CLOCK_REALTIME), - make_timespec (1000, 0)); + __make_timespec (1000, 0)); return pthread_clockjoin_np (thread, retval, CLOCK_REALTIME, &ts); #elif defined USE_PTHREAD_CLOCKJOIN_NP_MONOTONIC const struct timespec ts = timespec_add (xclock_now (CLOCK_MONOTONIC), - make_timespec (1000, 0)); + __make_timespec (1000, 0)); return pthread_clockjoin_np (thread, retval, CLOCK_MONOTONIC, &ts); #else return pthread_join (thread, retval); diff --git a/sysdeps/pthread/tst-mutex5.c b/sysdeps/pthread/tst-mutex5.c index 14490768c3..72fdbdaea5 100644 --- a/sysdeps/pthread/tst-mutex5.c +++ b/sysdeps/pthread/tst-mutex5.c @@ -68,7 +68,7 @@ do_test_clock (clockid_t clockid, const char *fnname) /* Wait 2 seconds. */ struct timespec ts_timeout = timespec_add (xclock_now (clockid_for_get), - make_timespec (2, 0)); + __make_timespec (2, 0)); if (clockid == CLOCK_USE_TIMEDLOCK) TEST_COMPARE (pthread_mutex_timedlock (&m, &ts_timeout), ETIMEDOUT); @@ -89,7 +89,7 @@ do_test_clock (clockid_t clockid, const char *fnname) const struct timespec ts_start = xclock_now (CLOCK_REALTIME); /* Wait 2 seconds. */ - ts_timeout = timespec_add (ts_start, make_timespec (2, 0)); + ts_timeout = timespec_add (ts_start, __make_timespec (2, 0)); if (clockid == CLOCK_USE_TIMEDLOCK) TEST_COMPARE (pthread_mutex_timedlock (&m, &ts_timeout), 0); @@ -100,7 +100,7 @@ do_test_clock (clockid_t clockid, const char *fnname) /* Check that timedlock didn't delay. We use a limit of 0.1 secs. */ TEST_TIMESPEC_BEFORE (ts_end, - timespec_add (ts_start, make_timespec (0, 100000000))); + timespec_add (ts_start, __make_timespec (0, 100000000))); TEST_COMPARE (pthread_mutex_unlock (&m), 0); TEST_COMPARE (pthread_mutex_destroy (&m), 0); diff --git a/sysdeps/pthread/tst-mutex9.c b/sysdeps/pthread/tst-mutex9.c index 2d7927b7c2..d03a22b97a 100644 --- a/sysdeps/pthread/tst-mutex9.c +++ b/sysdeps/pthread/tst-mutex9.c @@ -102,7 +102,7 @@ do_test_clock (clockid_t clockid) FAIL_EXIT1 ("child: mutex_unlock succeeded"); const struct timespec ts = timespec_add (xclock_now (clockid_for_get), - make_timespec (0, 500000000)); + __make_timespec (0, 500000000)); if (clockid == CLOCK_USE_TIMEDLOCK) TEST_COMPARE (pthread_mutex_timedlock (m, &ts), ETIMEDOUT); From patchwork Mon Jun 1 14:07:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 39396 X-Patchwork-Delegate: l.majewski@majess.pl Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8D476388C01A; Mon, 1 Jun 2020 14:08:06 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.10]) by sourceware.org (Postfix) with ESMTPS id E20F53870886 for ; Mon, 1 Jun 2020 14:08:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E20F53870886 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=lukma@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 49bH7l085qz1rwbJ; Mon, 1 Jun 2020 16:08:03 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 49bH7k67fNz1qwwd; Mon, 1 Jun 2020 16:08:02 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id GK3yqDtKA4-P; Mon, 1 Jun 2020 16:08:01 +0200 (CEST) X-Auth-Info: gN1nXj6WdBXgiLlxZk/ZiRd1jKSCOu9h8FasfIGOC9s= Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Mon, 1 Jun 2020 16:08:00 +0200 (CEST) From: Lukasz Majewski To: Joseph Myers , Paul Eggert , Adhemerval Zanella Subject: [RFC 04/12] y2038: Rename xclock_gettime to __xclock_gettime Date: Mon, 1 Jun 2020 16:07:32 +0200 Message-Id: <20200601140740.16371-5-lukma@denx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200601140740.16371-1-lukma@denx.de> References: <20200601140740.16371-1-lukma@denx.de> MIME-Version: 1.0 X-Spam-Status: No, score=-21.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Florian Weimer , GNU C Library , Andreas Schwab , Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" As the xclock_gettime is used locally in glibc, its name shall begin with "__". This change adds this prefix. Tested with glibc/glibc-many-build --keep failed glibcs --- nptl/tst-rwlock6.c | 10 +++++----- nptl/tst-rwlock7.c | 6 +++--- nptl/tst-rwlock9.c | 4 ++-- nptl/tst-sem5.c | 2 +- support/timespec.h | 4 ++-- support/xclock_gettime.c | 3 +-- support/xtime.h | 5 +++-- sysdeps/pthread/tst-cond11.c | 2 +- sysdeps/pthread/tst-rwlock14.c | 2 +- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/nptl/tst-rwlock6.c b/nptl/tst-rwlock6.c index 8714381a16..ade2b3050b 100644 --- a/nptl/tst-rwlock6.c +++ b/nptl/tst-rwlock6.c @@ -60,7 +60,7 @@ tf (void *arg) /* Timeout: 0.3 secs. */ struct timespec ts_start; - xclock_gettime (clockid_for_get, &ts_start); + __xclock_gettime (clockid_for_get, &ts_start); struct timespec ts_timeout = timespec_add (ts_start, __make_timespec (0, 300000000)); @@ -77,7 +77,7 @@ tf (void *arg) TEST_TIMESPEC_NOW_OR_AFTER (CLOCK_REALTIME, ts_timeout); - xclock_gettime (clockid_for_get, &ts_timeout); + __xclock_gettime (clockid_for_get, &ts_timeout); ts_timeout.tv_sec += 10; /* Note that the following operation makes ts invalid. */ ts_timeout.tv_nsec += 1000000000; @@ -117,7 +117,7 @@ do_test_clock (clockid_t clockid, const char *fnname) FAIL_EXIT1 ("round %Zu: rwlockattr_destroy failed\n", cnt); struct timespec ts; - xclock_gettime (clockid_for_get, &ts); + __xclock_gettime (clockid_for_get, &ts); ++ts.tv_sec; /* Get a write lock. */ @@ -130,7 +130,7 @@ do_test_clock (clockid_t clockid, const char *fnname) verbose_printf ("1st %swrlock done\n", fnname); - xclock_gettime (clockid_for_get, &ts); + __xclock_gettime (clockid_for_get, &ts); ++ts.tv_sec; if (clockid == CLOCK_USE_TIMEDLOCK) TEST_COMPARE (pthread_rwlock_timedrdlock (&r, &ts), EDEADLK); @@ -139,7 +139,7 @@ do_test_clock (clockid_t clockid, const char *fnname) verbose_printf ("1st %srdlock done\n", fnname); - xclock_gettime (clockid_for_get, &ts); + __xclock_gettime (clockid_for_get, &ts); ++ts.tv_sec; if (clockid == CLOCK_USE_TIMEDLOCK) TEST_COMPARE (pthread_rwlock_timedwrlock (&r, &ts), EDEADLK); diff --git a/nptl/tst-rwlock7.c b/nptl/tst-rwlock7.c index bdbfb5dac9..7dcb2d17ae 100644 --- a/nptl/tst-rwlock7.c +++ b/nptl/tst-rwlock7.c @@ -59,7 +59,7 @@ tf (void *arg) /* Timeout: 0.3 secs. */ struct timespec ts_start; - xclock_gettime (clockid_for_get, &ts_start); + __xclock_gettime (clockid_for_get, &ts_start); const struct timespec ts_timeout = timespec_add (ts_start, __make_timespec (0, 300000000)); @@ -73,7 +73,7 @@ tf (void *arg) TEST_TIMESPEC_NOW_OR_AFTER (clockid_for_get, ts_timeout); struct timespec ts_invalid; - xclock_gettime (clockid_for_get, &ts_invalid); + __xclock_gettime (clockid_for_get, &ts_invalid); ts_invalid.tv_sec += 10; /* Note that the following operation makes ts invalid. */ ts_invalid.tv_nsec += 1000000000; @@ -113,7 +113,7 @@ do_test_clock (clockid_t clockid, const char *fnname) FAIL_EXIT1 ("round %Zu: rwlockattr_destroy failed\n", cnt); struct timespec ts; - xclock_gettime (clockid_for_get, &ts); + __xclock_gettime (clockid_for_get, &ts); ++ts.tv_sec; diff --git a/nptl/tst-rwlock9.c b/nptl/tst-rwlock9.c index 408bbcdd5d..f35ed6feaa 100644 --- a/nptl/tst-rwlock9.c +++ b/nptl/tst-rwlock9.c @@ -73,7 +73,7 @@ writer_thread (void *arg) int e; do { - xclock_gettime (clockid_for_get, &ts); + __xclock_gettime (clockid_for_get, &ts); ts = timespec_add (ts, timeout); ts = timespec_add (ts, timeout); @@ -120,7 +120,7 @@ reader_thread (void *arg) int e; do { - xclock_gettime (clockid_for_get, &ts); + __xclock_gettime (clockid_for_get, &ts); ts = timespec_add (ts, timeout); diff --git a/nptl/tst-sem5.c b/nptl/tst-sem5.c index 8f5c5b9bb1..611fff3e69 100644 --- a/nptl/tst-sem5.c +++ b/nptl/tst-sem5.c @@ -41,7 +41,7 @@ do_test_clock (clockid_t clockid) TEST_COMPARE (TEMP_FAILURE_RETRY (sem_wait (&s)), 0); /* We wait for half a second. */ - xclock_gettime (clockid_for_get, &ts); + __xclock_gettime (clockid_for_get, &ts); ts = timespec_add (ts, __make_timespec (0, TIMESPEC_HZ/2)); errno = 0; diff --git a/support/timespec.h b/support/timespec.h index dbe12938d8..08df1d473b 100644 --- a/support/timespec.h +++ b/support/timespec.h @@ -57,7 +57,7 @@ void test_timespec_equal_or_after_impl (const char *file, int line, ({ \ struct timespec now; \ const int saved_errno = errno; \ - xclock_gettime ((clockid), &now); \ + __xclock_gettime ((clockid), &now); \ TEST_TIMESPEC_BEFORE ((left), now); \ errno = saved_errno; \ }) @@ -71,7 +71,7 @@ void test_timespec_equal_or_after_impl (const char *file, int line, ({ \ struct timespec now; \ const int saved_errno = errno; \ - xclock_gettime ((clockid), &now); \ + __xclock_gettime ((clockid), &now); \ TEST_TIMESPEC_EQUAL_OR_AFTER (now, (right)); \ errno = saved_errno; \ }) diff --git a/support/xclock_gettime.c b/support/xclock_gettime.c index 47f78016a0..fed397b784 100644 --- a/support/xclock_gettime.c +++ b/support/xclock_gettime.c @@ -21,8 +21,7 @@ #include void -xclock_gettime (clockid_t clockid, - struct timespec *ts) +__xclock_gettime (clockid_t clockid, struct timespec *ts) { const int ret = clock_gettime (clockid, ts); if (ret < 0) diff --git a/support/xtime.h b/support/xtime.h index 65edbb01d3..0912ead0ec 100644 --- a/support/xtime.h +++ b/support/xtime.h @@ -20,13 +20,14 @@ #define SUPPORT_TIME_H #include +#include __BEGIN_DECLS /* The following functions call the corresponding libc functions and terminate the process on error. */ -void xclock_gettime (clockid_t clock, struct timespec *ts); +void __xclock_gettime (clockid_t clock, struct timespec *ts); /* This helper can often simplify tests by avoiding an explicit variable declaration or allowing that declaration to be const. */ @@ -34,7 +35,7 @@ void xclock_gettime (clockid_t clock, struct timespec *ts); static inline struct timespec xclock_now (clockid_t clock) { struct timespec ts; - xclock_gettime (clock, &ts); + __xclock_gettime (clock, &ts); return ts; } diff --git a/sysdeps/pthread/tst-cond11.c b/sysdeps/pthread/tst-cond11.c index 209e2f0c8d..5d510859a0 100644 --- a/sysdeps/pthread/tst-cond11.c +++ b/sysdeps/pthread/tst-cond11.c @@ -61,7 +61,7 @@ run_test (clockid_t attr_clock, clockid_t wait_clock) TEST_COMPARE (pthread_mutex_lock (&mut), EDEADLK); struct timespec ts_timeout; - xclock_gettime (wait_clock == CLOCK_USE_ATTR_CLOCK ? attr_clock : wait_clock, + __xclock_gettime (wait_clock == CLOCK_USE_ATTR_CLOCK ? attr_clock : wait_clock, &ts_timeout); /* Wait one second. */ diff --git a/sysdeps/pthread/tst-rwlock14.c b/sysdeps/pthread/tst-rwlock14.c index 3583b19e3c..225bfae486 100644 --- a/sysdeps/pthread/tst-rwlock14.c +++ b/sysdeps/pthread/tst-rwlock14.c @@ -52,7 +52,7 @@ do_test (void) { struct timespec ts; - xclock_gettime (CLOCK_REALTIME, &ts); + __xclock_gettime (CLOCK_REALTIME, &ts); xpthread_barrier_init (&b, NULL, 2); pthread_t me = pthread_self (); From patchwork Mon Jun 1 14:07:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 39397 X-Patchwork-Delegate: l.majewski@majess.pl Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E0B81383F878; Mon, 1 Jun 2020 14:08:08 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by sourceware.org (Postfix) with ESMTPS id F3A24383F848 for ; Mon, 1 Jun 2020 14:08:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org F3A24383F848 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=lukma@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 49bH7n0bLWz1qsbT; Mon, 1 Jun 2020 16:08:05 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 49bH7m6wQYz1qwwd; Mon, 1 Jun 2020 16:08:04 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id 7Jj9A8BF852z; Mon, 1 Jun 2020 16:08:03 +0200 (CEST) X-Auth-Info: kmX6tZpjkYSNzWpKTJq1//usDfiE4toVwTt5P8hL+Po= Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Mon, 1 Jun 2020 16:08:03 +0200 (CEST) From: Lukasz Majewski To: Joseph Myers , Paul Eggert , Adhemerval Zanella Subject: [RFC 05/12] y2038: Rename xclock_now to __xclock_now Date: Mon, 1 Jun 2020 16:07:33 +0200 Message-Id: <20200601140740.16371-6-lukma@denx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200601140740.16371-1-lukma@denx.de> References: <20200601140740.16371-1-lukma@denx.de> MIME-Version: 1.0 X-Spam-Status: No, score=-21.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Florian Weimer , GNU C Library , Andreas Schwab , Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" As the xclock_now is used locally in glibc, its name shall begin with "__". This change adds this prefix. Tested with glibc/glibc-many-build --keep failed glibcs --- nptl/tst-eintr2.c | 2 +- nptl/tst-eintr5.c | 2 +- support/xtime.h | 2 +- sysdeps/pthread/tst-cond27.c | 2 +- sysdeps/pthread/tst-join3.c | 4 ++-- sysdeps/pthread/tst-join5.c | 6 +++--- sysdeps/pthread/tst-mutex5.c | 6 +++--- sysdeps/pthread/tst-mutex9.c | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/nptl/tst-eintr2.c b/nptl/tst-eintr2.c index eba8065236..68a8453f34 100644 --- a/nptl/tst-eintr2.c +++ b/nptl/tst-eintr2.c @@ -37,7 +37,7 @@ static pthread_mutex_t m2 = PTHREAD_MUTEX_INITIALIZER; static void * tf1 (void *arg) { - struct timespec ts = timespec_add (xclock_now (CLOCK_REALTIME), + struct timespec ts = timespec_add (__xclock_now (CLOCK_REALTIME), __make_timespec (10000, 0)); /* This call must never return. */ diff --git a/nptl/tst-eintr5.c b/nptl/tst-eintr5.c index 4edfbaaef6..3130f0fa08 100644 --- a/nptl/tst-eintr5.c +++ b/nptl/tst-eintr5.c @@ -38,7 +38,7 @@ static pthread_cond_t c = PTHREAD_COND_INITIALIZER; static void * tf (void *arg) { - struct timespec ts = timespec_add (xclock_now (CLOCK_REALTIME), + struct timespec ts = timespec_add (__xclock_now (CLOCK_REALTIME), __make_timespec (10000, 0)); /* This call must never return. */ diff --git a/support/xtime.h b/support/xtime.h index 0912ead0ec..0fce19a78d 100644 --- a/support/xtime.h +++ b/support/xtime.h @@ -32,7 +32,7 @@ void __xclock_gettime (clockid_t clock, struct timespec *ts); /* This helper can often simplify tests by avoiding an explicit variable declaration or allowing that declaration to be const. */ -static inline struct timespec xclock_now (clockid_t clock) +static inline struct timespec __xclock_now (clockid_t clock) { struct timespec ts; __xclock_gettime (clock, &ts); diff --git a/sysdeps/pthread/tst-cond27.c b/sysdeps/pthread/tst-cond27.c index 3d7b8240b1..5755d25ec8 100644 --- a/sysdeps/pthread/tst-cond27.c +++ b/sysdeps/pthread/tst-cond27.c @@ -40,7 +40,7 @@ do_test_clock (clockid_t clockid) xpthread_mutex_lock (&mut); /* Waiting for the condition will fail. But we want the timeout here. */ - const struct timespec ts_now = xclock_now (clockid); + const struct timespec ts_now = __xclock_now (clockid); const struct timespec ts_timeout = timespec_add (ts_now, __make_timespec (0, 500000000)); diff --git a/sysdeps/pthread/tst-join3.c b/sysdeps/pthread/tst-join3.c index fc54f12cc9..76df44c49e 100644 --- a/sysdeps/pthread/tst-join3.c +++ b/sysdeps/pthread/tst-join3.c @@ -53,7 +53,7 @@ do_test_clock (clockid_t clockid) pthread_t th = xpthread_create (NULL, tf, NULL); void *status; - struct timespec timeout = timespec_add (xclock_now (clockid_for_get), + struct timespec timeout = timespec_add (__xclock_now (clockid_for_get), __make_timespec (0, 200000000)); int val; @@ -68,7 +68,7 @@ do_test_clock (clockid_t clockid) while (1) { - timeout = timespec_add (xclock_now (clockid_for_get), + timeout = timespec_add (__xclock_now (clockid_for_get), __make_timespec (0, 200000000)); if (clockid == CLOCK_USE_TIMEDJOIN) diff --git a/sysdeps/pthread/tst-join5.c b/sysdeps/pthread/tst-join5.c index 525f349a4b..a72760a9ff 100644 --- a/sysdeps/pthread/tst-join5.c +++ b/sysdeps/pthread/tst-join5.c @@ -45,15 +45,15 @@ static int thread_join (pthread_t thread, void **retval) { #if defined USE_PTHREAD_TIMEDJOIN_NP - const struct timespec ts = timespec_add (xclock_now (CLOCK_REALTIME), + const struct timespec ts = timespec_add (__xclock_now (CLOCK_REALTIME), __make_timespec (1000, 0)); return pthread_timedjoin_np (thread, retval, &ts); #elif defined USE_PTHREAD_CLOCKJOIN_NP_REALTIME - const struct timespec ts = timespec_add (xclock_now (CLOCK_REALTIME), + const struct timespec ts = timespec_add (__xclock_now (CLOCK_REALTIME), __make_timespec (1000, 0)); return pthread_clockjoin_np (thread, retval, CLOCK_REALTIME, &ts); #elif defined USE_PTHREAD_CLOCKJOIN_NP_MONOTONIC - const struct timespec ts = timespec_add (xclock_now (CLOCK_MONOTONIC), + const struct timespec ts = timespec_add (__xclock_now (CLOCK_MONOTONIC), __make_timespec (1000, 0)); return pthread_clockjoin_np (thread, retval, CLOCK_MONOTONIC, &ts); #else diff --git a/sysdeps/pthread/tst-mutex5.c b/sysdeps/pthread/tst-mutex5.c index 72fdbdaea5..86f383a193 100644 --- a/sysdeps/pthread/tst-mutex5.c +++ b/sysdeps/pthread/tst-mutex5.c @@ -67,7 +67,7 @@ do_test_clock (clockid_t clockid, const char *fnname) FAIL_EXIT1 ("mutex_trylock succeeded"); /* Wait 2 seconds. */ - struct timespec ts_timeout = timespec_add (xclock_now (clockid_for_get), + struct timespec ts_timeout = timespec_add (__xclock_now (clockid_for_get), __make_timespec (2, 0)); if (clockid == CLOCK_USE_TIMEDLOCK) @@ -86,7 +86,7 @@ do_test_clock (clockid_t clockid, const char *fnname) TEST_COMPARE (pthread_mutex_clocklock (&m, clockid, &ts_timeout), EINVAL); TEST_COMPARE (pthread_mutex_unlock (&m), 0); - const struct timespec ts_start = xclock_now (CLOCK_REALTIME); + const struct timespec ts_start = __xclock_now (CLOCK_REALTIME); /* Wait 2 seconds. */ ts_timeout = timespec_add (ts_start, __make_timespec (2, 0)); @@ -96,7 +96,7 @@ do_test_clock (clockid_t clockid, const char *fnname) else TEST_COMPARE (pthread_mutex_clocklock (&m, clockid, &ts_timeout), 0); - const struct timespec ts_end = xclock_now (clockid_for_get); + const struct timespec ts_end = __xclock_now (clockid_for_get); /* Check that timedlock didn't delay. We use a limit of 0.1 secs. */ TEST_TIMESPEC_BEFORE (ts_end, diff --git a/sysdeps/pthread/tst-mutex9.c b/sysdeps/pthread/tst-mutex9.c index d03a22b97a..20e6d8d009 100644 --- a/sysdeps/pthread/tst-mutex9.c +++ b/sysdeps/pthread/tst-mutex9.c @@ -101,7 +101,7 @@ do_test_clock (clockid_t clockid) if (pthread_mutex_unlock (m) == 0) FAIL_EXIT1 ("child: mutex_unlock succeeded"); - const struct timespec ts = timespec_add (xclock_now (clockid_for_get), + const struct timespec ts = timespec_add (__xclock_now (clockid_for_get), __make_timespec (0, 500000000)); if (clockid == CLOCK_USE_TIMEDLOCK) From patchwork Mon Jun 1 14:07:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 39398 X-Patchwork-Delegate: l.majewski@majess.pl Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 40995388B01A; Mon, 1 Jun 2020 14:08:10 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by sourceware.org (Postfix) with ESMTPS id CACE2383F848 for ; Mon, 1 Jun 2020 14:08:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org CACE2383F848 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=lukma@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 49bH7p6Lxcz1qsbQ; Mon, 1 Jun 2020 16:08:06 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 49bH7p60Yjz1qwwd; Mon, 1 Jun 2020 16:08:06 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id e0I59G3ogxWI; Mon, 1 Jun 2020 16:08:05 +0200 (CEST) X-Auth-Info: WMdUIZKiuBZdNRFiumRwAZyyvtogJM/qegXxxpIdnq4= Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Mon, 1 Jun 2020 16:08:05 +0200 (CEST) From: Lukasz Majewski To: Joseph Myers , Paul Eggert , Adhemerval Zanella Subject: [RFC 06/12] y2038: Rename timespec_sub to __timespec_sub Date: Mon, 1 Jun 2020 16:07:34 +0200 Message-Id: <20200601140740.16371-7-lukma@denx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200601140740.16371-1-lukma@denx.de> References: <20200601140740.16371-1-lukma@denx.de> MIME-Version: 1.0 X-Spam-Status: No, score=-21.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Florian Weimer , GNU C Library , Andreas Schwab , Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" As the timespec_sub is used locally in glibc, its name shall begin with "__". This change adds this prefix. Tested with glibc/glibc-many-build --keep failed glibcs --- support/timespec-sub.c | 2 +- support/timespec.c | 4 ++-- support/timespec.h | 2 +- sysdeps/mach/clock_nanosleep.c | 4 ++-- sysdeps/pthread/posix-timer.h | 4 ++-- sysdeps/pthread/timer_gettime.c | 2 +- sysdeps/pthread/timer_settime.c | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/support/timespec-sub.c b/support/timespec-sub.c index 535a3b155b..836f1e4f70 100644 --- a/support/timespec-sub.c +++ b/support/timespec-sub.c @@ -27,7 +27,7 @@ #include "intprops.h" struct timespec -timespec_sub (struct timespec a, struct timespec b) +__timespec_sub (struct timespec a, struct timespec b) { time_t rs = a.tv_sec; time_t bs = b.tv_sec; diff --git a/support/timespec.c b/support/timespec.c index ea6b947546..3647caed36 100644 --- a/support/timespec.c +++ b/support/timespec.c @@ -29,7 +29,7 @@ test_timespec_before_impl (const char *file, int line, || (left.tv_sec == right.tv_sec && left.tv_nsec > right.tv_nsec)) { support_record_failure (); - const struct timespec diff = timespec_sub (left, right); + const struct timespec diff = __timespec_sub (left, right); printf ("%s:%d: %jd.%09jds not before %jd.%09jds " "(difference %jd.%09jds)\n", file, line, @@ -48,7 +48,7 @@ test_timespec_equal_or_after_impl (const char *file, int line, || (left.tv_sec == right.tv_sec && left.tv_nsec < right.tv_nsec)) { support_record_failure (); - const struct timespec diff = timespec_sub (right, left); + const struct timespec diff = __timespec_sub (right, left); printf ("%s:%d: %jd.%09jds not after %jd.%09jds " "(difference %jd.%09jds)\n", file, line, diff --git a/support/timespec.h b/support/timespec.h index 08df1d473b..9fdcea2fa4 100644 --- a/support/timespec.h +++ b/support/timespec.h @@ -26,7 +26,7 @@ struct timespec timespec_add (struct timespec, struct timespec) __attribute__((const)); -struct timespec timespec_sub (struct timespec, struct timespec) +struct timespec __timespec_sub (struct timespec, struct timespec) __attribute__((const)); static inline struct timespec diff --git a/sysdeps/mach/clock_nanosleep.c b/sysdeps/mach/clock_nanosleep.c index 23ebc15274..bb3c76a8ac 100644 --- a/sysdeps/mach/clock_nanosleep.c +++ b/sysdeps/mach/clock_nanosleep.c @@ -53,8 +53,8 @@ nanosleep_call (const struct timespec *req, struct timespec *rem) { struct timespec after, elapsed; __clock_gettime (CLOCK_REALTIME, &after); - timespec_sub (&elapsed, &after, &before); - timespec_sub (rem, req, &elapsed); + __timespec_sub (&elapsed, &after, &before); + __timespec_sub (rem, req, &elapsed); } return EINTR; diff --git a/sysdeps/pthread/posix-timer.h b/sysdeps/pthread/posix-timer.h index 7d9207e23d..115e5c931d 100644 --- a/sysdeps/pthread/posix-timer.h +++ b/sysdeps/pthread/posix-timer.h @@ -145,8 +145,8 @@ timespec_add (struct timespec *sum, const struct timespec *left, } static inline void -timespec_sub (struct timespec *diff, const struct timespec *left, - const struct timespec *right) +__timespec_sub (struct timespec *diff, const struct timespec *left, + const struct timespec *right) { diff->tv_sec = left->tv_sec - right->tv_sec; diff->tv_nsec = left->tv_nsec - right->tv_nsec; diff --git a/sysdeps/pthread/timer_gettime.c b/sysdeps/pthread/timer_gettime.c index 6cbf87f434..3f5e1bbab1 100644 --- a/sysdeps/pthread/timer_gettime.c +++ b/sysdeps/pthread/timer_gettime.c @@ -52,7 +52,7 @@ timer_gettime (timer_t timerid, struct itimerspec *value) { __clock_gettime (clock, &now); if (__timespec_compare (&now, &expiry) < 0) - timespec_sub (&value->it_value, &expiry, &now); + __timespec_sub (&value->it_value, &expiry, &now); else { value->it_value.tv_sec = 0; diff --git a/sysdeps/pthread/timer_settime.c b/sysdeps/pthread/timer_settime.c index b84da6e09f..fe4b32089d 100644 --- a/sysdeps/pthread/timer_settime.c +++ b/sysdeps/pthread/timer_settime.c @@ -84,7 +84,7 @@ timer_settime (timer_t timerid, int flags, const struct itimerspec *value, timer_addref (timer); } - timespec_sub (&ovalue->it_value, &timer->expirytime, &now); + __timespec_sub (&ovalue->it_value, &timer->expirytime, &now); } else { From patchwork Mon Jun 1 14:07:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 39399 X-Patchwork-Delegate: l.majewski@majess.pl Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9BDF8388F047; Mon, 1 Jun 2020 14:08:13 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by sourceware.org (Postfix) with ESMTPS id 1F8AE383F848 for ; Mon, 1 Jun 2020 14:08:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1F8AE383F848 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=lukma@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 49bH7s1cTdz1qsbV; Mon, 1 Jun 2020 16:08:09 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 49bH7s19CPz1qwwd; Mon, 1 Jun 2020 16:08:09 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id mlQ9Dl1Yjceb; Mon, 1 Jun 2020 16:08:07 +0200 (CEST) X-Auth-Info: f4L2m/dFEA0IGcv0/1vxuNuFlIFiT2+4V8Qk5ubZo8s= Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Mon, 1 Jun 2020 16:08:06 +0200 (CEST) From: Lukasz Majewski To: Joseph Myers , Paul Eggert , Adhemerval Zanella Subject: [RFC 07/12] y2038: Rename timespec_add to __timespec_add Date: Mon, 1 Jun 2020 16:07:35 +0200 Message-Id: <20200601140740.16371-8-lukma@denx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200601140740.16371-1-lukma@denx.de> References: <20200601140740.16371-1-lukma@denx.de> MIME-Version: 1.0 X-Spam-Status: No, score=-21.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Florian Weimer , GNU C Library , Andreas Schwab , Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" As the timespec_add is used locally in glibc, its name shall begin with "__". This change adds this prefix. Tested with glibc/glibc-many-build --keep failed glibcs --- nptl/tst-eintr2.c | 4 ++-- nptl/tst-eintr5.c | 4 ++-- nptl/tst-rwlock6.c | 4 ++-- nptl/tst-rwlock7.c | 4 ++-- nptl/tst-rwlock9.c | 6 +++--- nptl/tst-sem5.c | 2 +- support/timespec-add.c | 2 +- support/timespec.h | 2 +- sysdeps/pthread/posix-timer.h | 4 ++-- sysdeps/pthread/timer_routines.c | 8 ++++---- sysdeps/pthread/timer_settime.c | 2 +- sysdeps/pthread/tst-cond27.c | 2 +- sysdeps/pthread/tst-join3.c | 8 ++++---- sysdeps/pthread/tst-join5.c | 12 ++++++------ sysdeps/pthread/tst-mutex5.c | 8 ++++---- sysdeps/pthread/tst-mutex9.c | 4 ++-- 16 files changed, 38 insertions(+), 38 deletions(-) diff --git a/nptl/tst-eintr2.c b/nptl/tst-eintr2.c index 68a8453f34..b7c3f21265 100644 --- a/nptl/tst-eintr2.c +++ b/nptl/tst-eintr2.c @@ -37,8 +37,8 @@ static pthread_mutex_t m2 = PTHREAD_MUTEX_INITIALIZER; static void * tf1 (void *arg) { - struct timespec ts = timespec_add (__xclock_now (CLOCK_REALTIME), - __make_timespec (10000, 0)); + struct timespec ts = __timespec_add (__xclock_now (CLOCK_REALTIME), + __make_timespec (10000, 0)); /* This call must never return. */ int e = pthread_mutex_timedlock (&m1, &ts); diff --git a/nptl/tst-eintr5.c b/nptl/tst-eintr5.c index 3130f0fa08..b286fdff77 100644 --- a/nptl/tst-eintr5.c +++ b/nptl/tst-eintr5.c @@ -38,8 +38,8 @@ static pthread_cond_t c = PTHREAD_COND_INITIALIZER; static void * tf (void *arg) { - struct timespec ts = timespec_add (__xclock_now (CLOCK_REALTIME), - __make_timespec (10000, 0)); + struct timespec ts = __timespec_add (__xclock_now (CLOCK_REALTIME), + __make_timespec (10000, 0)); /* This call must never return. */ TEST_COMPARE (pthread_cond_timedwait (&c, &m, &ts), 0); diff --git a/nptl/tst-rwlock6.c b/nptl/tst-rwlock6.c index ade2b3050b..37bc2d2c0b 100644 --- a/nptl/tst-rwlock6.c +++ b/nptl/tst-rwlock6.c @@ -62,8 +62,8 @@ tf (void *arg) struct timespec ts_start; __xclock_gettime (clockid_for_get, &ts_start); - struct timespec ts_timeout = timespec_add (ts_start, - __make_timespec (0, 300000000)); + struct timespec ts_timeout = __timespec_add (ts_start, + __make_timespec (0, 300000000)); verbose_printf ("child calling %srdlock\n", fnname); diff --git a/nptl/tst-rwlock7.c b/nptl/tst-rwlock7.c index 7dcb2d17ae..c13ad20f54 100644 --- a/nptl/tst-rwlock7.c +++ b/nptl/tst-rwlock7.c @@ -60,8 +60,8 @@ tf (void *arg) /* Timeout: 0.3 secs. */ struct timespec ts_start; __xclock_gettime (clockid_for_get, &ts_start); - const struct timespec ts_timeout = timespec_add (ts_start, - __make_timespec (0, 300000000)); + const struct timespec ts_timeout = __timespec_add (ts_start, + __make_timespec (0, 300000000)); if (clockid == CLOCK_USE_TIMEDLOCK) TEST_COMPARE (pthread_rwlock_timedwrlock (r, &ts_timeout), ETIMEDOUT); diff --git a/nptl/tst-rwlock9.c b/nptl/tst-rwlock9.c index f35ed6feaa..14232c89a1 100644 --- a/nptl/tst-rwlock9.c +++ b/nptl/tst-rwlock9.c @@ -75,8 +75,8 @@ writer_thread (void *arg) { __xclock_gettime (clockid_for_get, &ts); - ts = timespec_add (ts, timeout); - ts = timespec_add (ts, timeout); + ts = __timespec_add (ts, timeout); + ts = __timespec_add (ts, timeout); printf ("writer thread %d tries again\n", nr); @@ -122,7 +122,7 @@ reader_thread (void *arg) { __xclock_gettime (clockid_for_get, &ts); - ts = timespec_add (ts, timeout); + ts = __timespec_add (ts, timeout); printf ("reader thread %d tries again\n", nr); diff --git a/nptl/tst-sem5.c b/nptl/tst-sem5.c index 611fff3e69..6519dcce8b 100644 --- a/nptl/tst-sem5.c +++ b/nptl/tst-sem5.c @@ -42,7 +42,7 @@ do_test_clock (clockid_t clockid) /* We wait for half a second. */ __xclock_gettime (clockid_for_get, &ts); - ts = timespec_add (ts, __make_timespec (0, TIMESPEC_HZ/2)); + ts = __timespec_add (ts, __make_timespec (0, TIMESPEC_HZ/2)); errno = 0; TEST_COMPARE (TEMP_FAILURE_RETRY ((clockid == CLOCK_USE_TIMEDWAIT) diff --git a/support/timespec-add.c b/support/timespec-add.c index bb22b12e9b..a2eb43791e 100644 --- a/support/timespec-add.c +++ b/support/timespec-add.c @@ -26,7 +26,7 @@ #include "intprops.h" struct timespec -timespec_add (struct timespec a, struct timespec b) +__timespec_add (struct timespec a, struct timespec b) { time_t rs = a.tv_sec; time_t bs = b.tv_sec; diff --git a/support/timespec.h b/support/timespec.h index 9fdcea2fa4..936d0b0d84 100644 --- a/support/timespec.h +++ b/support/timespec.h @@ -24,7 +24,7 @@ #include #include -struct timespec timespec_add (struct timespec, struct timespec) +struct timespec __timespec_add (struct timespec, struct timespec) __attribute__((const)); struct timespec __timespec_sub (struct timespec, struct timespec) __attribute__((const)); diff --git a/sysdeps/pthread/posix-timer.h b/sysdeps/pthread/posix-timer.h index 115e5c931d..312cf2b3bd 100644 --- a/sysdeps/pthread/posix-timer.h +++ b/sysdeps/pthread/posix-timer.h @@ -131,8 +131,8 @@ __timespec_compare (const struct timespec *left, const struct timespec *right) } static inline void -timespec_add (struct timespec *sum, const struct timespec *left, - const struct timespec *right) +__timespec_add (struct timespec *sum, const struct timespec *left, + const struct timespec *right) { sum->tv_sec = left->tv_sec + right->tv_sec; sum->tv_nsec = left->tv_nsec + right->tv_nsec; diff --git a/sysdeps/pthread/timer_routines.c b/sysdeps/pthread/timer_routines.c index be9b09a832..d866c705b1 100644 --- a/sysdeps/pthread/timer_routines.c +++ b/sysdeps/pthread/timer_routines.c @@ -392,12 +392,12 @@ thread_func (void *arg) || timer->value.it_interval.tv_nsec != 0) { timer->overrun_count = 0; - timespec_add (&timer->expirytime, &timer->expirytime, - &timer->value.it_interval); + __timespec_add (&timer->expirytime, &timer->expirytime, + &timer->value.it_interval); while (__timespec_compare (&timer->expirytime, &now) < 0) { - timespec_add (&timer->expirytime, &timer->expirytime, - &timer->value.it_interval); + __timespec_add (&timer->expirytime, &timer->expirytime, + &timer->value.it_interval); if (timer->overrun_count < DELAYTIMER_MAX) ++timer->overrun_count; } diff --git a/sysdeps/pthread/timer_settime.c b/sysdeps/pthread/timer_settime.c index fe4b32089d..77aa3460d5 100644 --- a/sysdeps/pthread/timer_settime.c +++ b/sysdeps/pthread/timer_settime.c @@ -108,7 +108,7 @@ timer_settime (timer_t timerid, int flags, const struct itimerspec *value, /* The user specified the expiration time. */ timer->expirytime = value->it_value; else - timespec_add (&timer->expirytime, &now, &value->it_value); + __timespec_add (&timer->expirytime, &now, &value->it_value); /* Only need to wake up the thread if timer is inserted at the head of the queue. */ diff --git a/sysdeps/pthread/tst-cond27.c b/sysdeps/pthread/tst-cond27.c index 5755d25ec8..adc77bd008 100644 --- a/sysdeps/pthread/tst-cond27.c +++ b/sysdeps/pthread/tst-cond27.c @@ -42,7 +42,7 @@ do_test_clock (clockid_t clockid) /* Waiting for the condition will fail. But we want the timeout here. */ const struct timespec ts_now = __xclock_now (clockid); const struct timespec ts_timeout = - timespec_add (ts_now, __make_timespec (0, 500000000)); + __timespec_add (ts_now, __make_timespec (0, 500000000)); /* In theory pthread_cond_clockwait could return zero here due to spurious wakeup. However that can't happen without a signal or an diff --git a/sysdeps/pthread/tst-join3.c b/sysdeps/pthread/tst-join3.c index 76df44c49e..f69f81a1b4 100644 --- a/sysdeps/pthread/tst-join3.c +++ b/sysdeps/pthread/tst-join3.c @@ -53,8 +53,8 @@ do_test_clock (clockid_t clockid) pthread_t th = xpthread_create (NULL, tf, NULL); void *status; - struct timespec timeout = timespec_add (__xclock_now (clockid_for_get), - __make_timespec (0, 200000000)); + struct timespec timeout = __timespec_add (__xclock_now (clockid_for_get), + __make_timespec (0, 200000000)); int val; if (clockid == CLOCK_USE_TIMEDJOIN) @@ -68,8 +68,8 @@ do_test_clock (clockid_t clockid) while (1) { - timeout = timespec_add (__xclock_now (clockid_for_get), - __make_timespec (0, 200000000)); + timeout = __timespec_add (__xclock_now (clockid_for_get), + __make_timespec (0, 200000000)); if (clockid == CLOCK_USE_TIMEDJOIN) val = pthread_timedjoin_np (th, &status, &timeout); diff --git a/sysdeps/pthread/tst-join5.c b/sysdeps/pthread/tst-join5.c index a72760a9ff..797e73725e 100644 --- a/sysdeps/pthread/tst-join5.c +++ b/sysdeps/pthread/tst-join5.c @@ -45,16 +45,16 @@ static int thread_join (pthread_t thread, void **retval) { #if defined USE_PTHREAD_TIMEDJOIN_NP - const struct timespec ts = timespec_add (__xclock_now (CLOCK_REALTIME), - __make_timespec (1000, 0)); + const struct timespec ts = __timespec_add (__xclock_now (CLOCK_REALTIME), + __make_timespec (1000, 0)); return pthread_timedjoin_np (thread, retval, &ts); #elif defined USE_PTHREAD_CLOCKJOIN_NP_REALTIME - const struct timespec ts = timespec_add (__xclock_now (CLOCK_REALTIME), - __make_timespec (1000, 0)); + const struct timespec ts = __timespec_add (__xclock_now (CLOCK_REALTIME), + __make_timespec (1000, 0)); return pthread_clockjoin_np (thread, retval, CLOCK_REALTIME, &ts); #elif defined USE_PTHREAD_CLOCKJOIN_NP_MONOTONIC - const struct timespec ts = timespec_add (__xclock_now (CLOCK_MONOTONIC), - __make_timespec (1000, 0)); + const struct timespec ts = __timespec_add (__xclock_now (CLOCK_MONOTONIC), + __make_timespec (1000, 0)); return pthread_clockjoin_np (thread, retval, CLOCK_MONOTONIC, &ts); #else return pthread_join (thread, retval); diff --git a/sysdeps/pthread/tst-mutex5.c b/sysdeps/pthread/tst-mutex5.c index 86f383a193..fa21aac4e3 100644 --- a/sysdeps/pthread/tst-mutex5.c +++ b/sysdeps/pthread/tst-mutex5.c @@ -67,8 +67,8 @@ do_test_clock (clockid_t clockid, const char *fnname) FAIL_EXIT1 ("mutex_trylock succeeded"); /* Wait 2 seconds. */ - struct timespec ts_timeout = timespec_add (__xclock_now (clockid_for_get), - __make_timespec (2, 0)); + struct timespec ts_timeout = __timespec_add (__xclock_now (clockid_for_get), + __make_timespec (2, 0)); if (clockid == CLOCK_USE_TIMEDLOCK) TEST_COMPARE (pthread_mutex_timedlock (&m, &ts_timeout), ETIMEDOUT); @@ -89,7 +89,7 @@ do_test_clock (clockid_t clockid, const char *fnname) const struct timespec ts_start = __xclock_now (CLOCK_REALTIME); /* Wait 2 seconds. */ - ts_timeout = timespec_add (ts_start, __make_timespec (2, 0)); + ts_timeout = __timespec_add (ts_start, __make_timespec (2, 0)); if (clockid == CLOCK_USE_TIMEDLOCK) TEST_COMPARE (pthread_mutex_timedlock (&m, &ts_timeout), 0); @@ -100,7 +100,7 @@ do_test_clock (clockid_t clockid, const char *fnname) /* Check that timedlock didn't delay. We use a limit of 0.1 secs. */ TEST_TIMESPEC_BEFORE (ts_end, - timespec_add (ts_start, __make_timespec (0, 100000000))); + __timespec_add (ts_start, __make_timespec (0, 100000000))); TEST_COMPARE (pthread_mutex_unlock (&m), 0); TEST_COMPARE (pthread_mutex_destroy (&m), 0); diff --git a/sysdeps/pthread/tst-mutex9.c b/sysdeps/pthread/tst-mutex9.c index 20e6d8d009..27451f000f 100644 --- a/sysdeps/pthread/tst-mutex9.c +++ b/sysdeps/pthread/tst-mutex9.c @@ -101,8 +101,8 @@ do_test_clock (clockid_t clockid) if (pthread_mutex_unlock (m) == 0) FAIL_EXIT1 ("child: mutex_unlock succeeded"); - const struct timespec ts = timespec_add (__xclock_now (clockid_for_get), - __make_timespec (0, 500000000)); + const struct timespec ts = __timespec_add (__xclock_now (clockid_for_get), + __make_timespec (0, 500000000)); if (clockid == CLOCK_USE_TIMEDLOCK) TEST_COMPARE (pthread_mutex_timedlock (m, &ts), ETIMEDOUT); From patchwork Mon Jun 1 14:07:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 39400 X-Patchwork-Delegate: l.majewski@majess.pl Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F0A74388F059; Mon, 1 Jun 2020 14:08:13 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.10]) by sourceware.org (Postfix) with ESMTPS id DE940388F046 for ; Mon, 1 Jun 2020 14:08:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DE940388F046 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=lukma@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 49bH7v01Qhz1rtM9; Mon, 1 Jun 2020 16:08:11 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 49bH7t5vRSz1qwwd; Mon, 1 Jun 2020 16:08:10 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id 3dKcpqWmGK4f; Mon, 1 Jun 2020 16:08:09 +0200 (CEST) X-Auth-Info: SrOtiFN/TpNFK0tNXzVZcMOwyWwqov7wSO9AzjQFXwc= Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Mon, 1 Jun 2020 16:08:09 +0200 (CEST) From: Lukasz Majewski To: Joseph Myers , Paul Eggert , Adhemerval Zanella Subject: [RFC 08/12] y2038: Convert __make_timespec to be Y2038 safe Date: Mon, 1 Jun 2020 16:07:36 +0200 Message-Id: <20200601140740.16371-9-lukma@denx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200601140740.16371-1-lukma@denx.de> References: <20200601140740.16371-1-lukma@denx.de> MIME-Version: 1.0 X-Spam-Status: No, score=-21.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Florian Weimer , GNU C Library , Andreas Schwab , Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" The conversion was to use Y2038 safe struct __timespec64 and __time64_t. --- support/timespec.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/support/timespec.h b/support/timespec.h index 936d0b0d84..8de40d25f4 100644 --- a/support/timespec.h +++ b/support/timespec.h @@ -29,10 +29,10 @@ struct timespec __timespec_add (struct timespec, struct timespec) struct timespec __timespec_sub (struct timespec, struct timespec) __attribute__((const)); -static inline struct timespec -__make_timespec (time_t s, long int ns) +static inline struct __timespec64 +__make_timespec (__time64_t s, long int ns) { - struct timespec r; + struct __timespec64 r; r.tv_sec = s; r.tv_nsec = ns; return r; From patchwork Mon Jun 1 14:07:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 39401 X-Patchwork-Delegate: l.majewski@majess.pl Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C3E09388F063; Mon, 1 Jun 2020 14:08:15 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-out.m-online.net (mail-out.m-online.net [IPv6:2001:a60:0:28:0:1:25:1]) by sourceware.org (Postfix) with ESMTPS id 75205388F046 for ; Mon, 1 Jun 2020 14:08:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 75205388F046 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=lukma@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 49bH7w4mflz1rvBg; Mon, 1 Jun 2020 16:08:12 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 49bH7w4Q5nz1qwwd; Mon, 1 Jun 2020 16:08:12 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id MHesqUnKJVgi; Mon, 1 Jun 2020 16:08:11 +0200 (CEST) X-Auth-Info: 3OlPRGu6z40FE0OXG0sYnzBv+zIHpq8uA1tGXlYSnDU= Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Mon, 1 Jun 2020 16:08:11 +0200 (CEST) From: Lukasz Majewski To: Joseph Myers , Paul Eggert , Adhemerval Zanella Subject: [RFC 09/12] y2038: Convert __xclock_gettime to be Y2038 safe Date: Mon, 1 Jun 2020 16:07:37 +0200 Message-Id: <20200601140740.16371-10-lukma@denx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200601140740.16371-1-lukma@denx.de> References: <20200601140740.16371-1-lukma@denx.de> MIME-Version: 1.0 X-Spam-Status: No, score=-21.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Florian Weimer , GNU C Library , Andreas Schwab , Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" The clock_gettime has been replaced with Y2038 safe __clock_gettime64. Morevoer, the struct timespec has been replaced with struct __timespec64. --- support/xclock_gettime.c | 4 ++-- support/xtime.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/support/xclock_gettime.c b/support/xclock_gettime.c index fed397b784..6d32c00847 100644 --- a/support/xclock_gettime.c +++ b/support/xclock_gettime.c @@ -21,9 +21,9 @@ #include void -__xclock_gettime (clockid_t clockid, struct timespec *ts) +__xclock_gettime (clockid_t clockid, struct __timespec64 *ts) { - const int ret = clock_gettime (clockid, ts); + const int ret = __clock_gettime64 (clockid, ts); if (ret < 0) FAIL_EXIT1 ("clock_gettime (%d): %m", clockid); diff --git a/support/xtime.h b/support/xtime.h index 0fce19a78d..f04dac14fd 100644 --- a/support/xtime.h +++ b/support/xtime.h @@ -27,7 +27,7 @@ __BEGIN_DECLS /* The following functions call the corresponding libc functions and terminate the process on error. */ -void __xclock_gettime (clockid_t clock, struct timespec *ts); +void __xclock_gettime (clockid_t clock, struct __timespec64 *ts); /* This helper can often simplify tests by avoiding an explicit variable declaration or allowing that declaration to be const. */ From patchwork Mon Jun 1 14:07:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 39402 X-Patchwork-Delegate: l.majewski@majess.pl Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 43AA7388F066; Mon, 1 Jun 2020 14:08:17 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.10]) by sourceware.org (Postfix) with ESMTPS id 17245388F046 for ; Mon, 1 Jun 2020 14:08:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 17245388F046 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=lukma@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 49bH7y1HLTz1rvRr; Mon, 1 Jun 2020 16:08:14 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 49bH7y0zb0z1qwwd; Mon, 1 Jun 2020 16:08:14 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id nhl9ukiSPHy8; Mon, 1 Jun 2020 16:08:12 +0200 (CEST) X-Auth-Info: 0NlDCj90m08qSr/rlSEusbyxRGhJ7jA4v6ncrOHglaM= Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Mon, 1 Jun 2020 16:08:12 +0200 (CEST) From: Lukasz Majewski To: Joseph Myers , Paul Eggert , Adhemerval Zanella Subject: [RFC 10/12] y2038: Convert __xclock_now to be Y2038 safe Date: Mon, 1 Jun 2020 16:07:38 +0200 Message-Id: <20200601140740.16371-11-lukma@denx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200601140740.16371-1-lukma@denx.de> References: <20200601140740.16371-1-lukma@denx.de> MIME-Version: 1.0 X-Spam-Status: No, score=-20.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Florian Weimer , GNU C Library , Andreas Schwab , Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" The struct timespec has been replaced with Y2038 safe struct __timespec64. Tested with glibc/glibc-many-build --keep failed glibcs --- support/xtime.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/support/xtime.h b/support/xtime.h index f04dac14fd..91fac43711 100644 --- a/support/xtime.h +++ b/support/xtime.h @@ -32,9 +32,9 @@ void __xclock_gettime (clockid_t clock, struct __timespec64 *ts); /* This helper can often simplify tests by avoiding an explicit variable declaration or allowing that declaration to be const. */ -static inline struct timespec __xclock_now (clockid_t clock) +static inline struct __timespec64 __xclock_now (clockid_t clock) { - struct timespec ts; + struct __timespec64 ts; __xclock_gettime (clock, &ts); return ts; } From patchwork Mon Jun 1 14:07:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 39403 X-Patchwork-Delegate: l.majewski@majess.pl Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B9289388F062; Mon, 1 Jun 2020 14:08:19 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-out.m-online.net (mail-out.m-online.net [IPv6:2001:a60:0:28:0:1:25:1]) by sourceware.org (Postfix) with ESMTPS id 1CAAF388F046 for ; Mon, 1 Jun 2020 14:08:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1CAAF388F046 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=lukma@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 49bH802CQHz1rvSD; Mon, 1 Jun 2020 16:08:16 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 49bH8013xJz1qwwd; Mon, 1 Jun 2020 16:08:16 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id ddSrv4C6wtN5; Mon, 1 Jun 2020 16:08:14 +0200 (CEST) X-Auth-Info: VtdJUd17iAxU9OgOVgwrV5n0lEEzTkCg8jSGU/mRKz8= Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Mon, 1 Jun 2020 16:08:14 +0200 (CEST) From: Lukasz Majewski To: Joseph Myers , Paul Eggert , Adhemerval Zanella Subject: [RFC 11/12] y2038: Convert timespec* files in ./support to be Y2038 safe Date: Mon, 1 Jun 2020 16:07:39 +0200 Message-Id: <20200601140740.16371-12-lukma@denx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200601140740.16371-1-lukma@denx.de> References: <20200601140740.16371-1-lukma@denx.de> MIME-Version: 1.0 X-Spam-Status: No, score=-20.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Florian Weimer , GNU C Library , Andreas Schwab , Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" After this change functions in ./support/timespec* files: - __timespec_add - __timespec_sub - test_timespec_before_impl - test_timespec_equal_or_after_impl are Y2038 safe, as the struct timespec and time_t have been replaced with struct __timespec64 and __time64_t respectively. --- support/timespec-add.c | 10 +++++----- support/timespec-sub.c | 16 ++++++++-------- support/timespec.c | 12 ++++++------ support/timespec.h | 17 +++++++++-------- 4 files changed, 28 insertions(+), 27 deletions(-) diff --git a/support/timespec-add.c b/support/timespec-add.c index a2eb43791e..d2bcdae8de 100644 --- a/support/timespec-add.c +++ b/support/timespec-add.c @@ -25,11 +25,11 @@ #include "intprops.h" -struct timespec -__timespec_add (struct timespec a, struct timespec b) +struct __timespec64 +__timespec_add (struct __timespec64 a, struct __timespec64 b) { - time_t rs = a.tv_sec; - time_t bs = b.tv_sec; + __time64_t rs = a.tv_sec; + __time64_t bs = b.tv_sec; int ns = a.tv_nsec + b.tv_nsec; int nsd = ns - TIMESPEC_HZ; int rns = ns; @@ -37,7 +37,7 @@ __timespec_add (struct timespec a, struct timespec b) if (0 <= nsd) { rns = nsd; - time_t bs1; + __time64_t bs1; if (!INT_ADD_WRAPV (bs, 1, &bs1)) bs = bs1; else if (rs < 0) diff --git a/support/timespec-sub.c b/support/timespec-sub.c index 836f1e4f70..f0ae821ea4 100644 --- a/support/timespec-sub.c +++ b/support/timespec-sub.c @@ -26,21 +26,21 @@ #include "intprops.h" -struct timespec -__timespec_sub (struct timespec a, struct timespec b) +struct __timespec64 +__timespec_sub (struct __timespec64 a, struct __timespec64 b) { - time_t rs = a.tv_sec; - time_t bs = b.tv_sec; + __time64_t rs = a.tv_sec; + __time64_t bs = b.tv_sec; int ns = a.tv_nsec - b.tv_nsec; int rns = ns; if (ns < 0) { rns = ns + TIMESPEC_HZ; - time_t bs1; + __time64_t bs1; if (!INT_ADD_WRAPV (bs, 1, &bs1)) bs = bs1; - else if (- TYPE_SIGNED (time_t) < rs) + else if (- TYPE_SIGNED (__time64_t) < rs) rs--; else goto low_overflow; @@ -51,12 +51,12 @@ __timespec_sub (struct timespec a, struct timespec b) if (0 < bs) { low_overflow: - rs = TYPE_MINIMUM (time_t); + rs = TYPE_MINIMUM (__time64_t); rns = 0; } else { - rs = TYPE_MAXIMUM (time_t); + rs = TYPE_MAXIMUM (__time64_t); rns = TIMESPEC_HZ - 1; } } diff --git a/support/timespec.c b/support/timespec.c index 3647caed36..b69ce61c93 100644 --- a/support/timespec.c +++ b/support/timespec.c @@ -22,14 +22,14 @@ void test_timespec_before_impl (const char *file, int line, - const struct timespec left, - const struct timespec right) + const struct __timespec64 left, + const struct __timespec64 right) { if (left.tv_sec > right.tv_sec || (left.tv_sec == right.tv_sec && left.tv_nsec > right.tv_nsec)) { support_record_failure (); - const struct timespec diff = __timespec_sub (left, right); + const struct __timespec64 diff = __timespec_sub (left, right); printf ("%s:%d: %jd.%09jds not before %jd.%09jds " "(difference %jd.%09jds)\n", file, line, @@ -41,14 +41,14 @@ test_timespec_before_impl (const char *file, int line, void test_timespec_equal_or_after_impl (const char *file, int line, - const struct timespec left, - const struct timespec right) + const struct __timespec64 left, + const struct __timespec64 right) { if (left.tv_sec < right.tv_sec || (left.tv_sec == right.tv_sec && left.tv_nsec < right.tv_nsec)) { support_record_failure (); - const struct timespec diff = __timespec_sub (right, left); + const struct __timespec64 diff = __timespec_sub (right, left); printf ("%s:%d: %jd.%09jds not after %jd.%09jds " "(difference %jd.%09jds)\n", file, line, diff --git a/support/timespec.h b/support/timespec.h index 8de40d25f4..f0b054f5e9 100644 --- a/support/timespec.h +++ b/support/timespec.h @@ -23,10 +23,11 @@ #include #include #include +#include -struct timespec __timespec_add (struct timespec, struct timespec) +struct __timespec64 __timespec_add (struct __timespec64, struct __timespec64) __attribute__((const)); -struct timespec __timespec_sub (struct timespec, struct timespec) +struct __timespec64 __timespec_sub (struct __timespec64, struct __timespec64) __attribute__((const)); static inline struct __timespec64 @@ -41,12 +42,12 @@ __make_timespec (__time64_t s, long int ns) enum { TIMESPEC_HZ = 1000000000 }; void test_timespec_before_impl (const char *file, int line, - const struct timespec left, - const struct timespec right); + const struct __timespec64 left, + const struct __timespec64 right); void test_timespec_equal_or_after_impl (const char *file, int line, - const struct timespec left, - const struct timespec right); + const struct __timespec64 left, + const struct __timespec64 right); /* Check that the timespec on the left represents a time before the time on the right. */ @@ -55,7 +56,7 @@ void test_timespec_equal_or_after_impl (const char *file, int line, #define TEST_TIMESPEC_BEFORE_NOW(left, clockid) \ ({ \ - struct timespec now; \ + struct __timespec64 now; \ const int saved_errno = errno; \ __xclock_gettime ((clockid), &now); \ TEST_TIMESPEC_BEFORE ((left), now); \ @@ -69,7 +70,7 @@ void test_timespec_equal_or_after_impl (const char *file, int line, #define TEST_TIMESPEC_NOW_OR_AFTER(clockid, right) \ ({ \ - struct timespec now; \ + struct __timespec64 now; \ const int saved_errno = errno; \ __xclock_gettime ((clockid), &now); \ TEST_TIMESPEC_EQUAL_OR_AFTER (now, (right)); \ From patchwork Mon Jun 1 14:07:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 39404 X-Patchwork-Delegate: l.majewski@majess.pl Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1C821388F06B; Mon, 1 Jun 2020 14:08:21 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by sourceware.org (Postfix) with ESMTPS id D02D6388F046 for ; Mon, 1 Jun 2020 14:08:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D02D6388F046 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=lukma@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 49bH816nXJz1qsbM; Mon, 1 Jun 2020 16:08:17 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 49bH816Sdcz1qwwf; Mon, 1 Jun 2020 16:08:17 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id KWWVxVEYCGnF; Mon, 1 Jun 2020 16:08:16 +0200 (CEST) X-Auth-Info: 6D22ioJ4IzuhZJLJuvM0oi5pMniRQzYx5FIrOJJNKDk= Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Mon, 1 Jun 2020 16:08:16 +0200 (CEST) From: Lukasz Majewski To: Joseph Myers , Paul Eggert , Adhemerval Zanella Subject: [RFC 12/12] y2038: Convert timespec_* from posix-timer.h to be Y2038 safe Date: Mon, 1 Jun 2020 16:07:40 +0200 Message-Id: <20200601140740.16371-13-lukma@denx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200601140740.16371-1-lukma@denx.de> References: <20200601140740.16371-1-lukma@denx.de> MIME-Version: 1.0 X-Spam-Status: No, score=-20.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Florian Weimer , GNU C Library , Andreas Schwab , Alistair Francis Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Static inline functions - timespec_compare, timespec_sum and timespec_diff - from ./sysdeps/pthread/posix-timer.h have been converted to support 64 bit time on ports with __WORDSIZE == 32 && __TIMESIZE != 64. The change was focused on using struct __timespec64. Tested with glibc/glibc-many-build --keep failed glibcs --- sysdeps/pthread/posix-timer.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sysdeps/pthread/posix-timer.h b/sysdeps/pthread/posix-timer.h index 312cf2b3bd..f6572480c9 100644 --- a/sysdeps/pthread/posix-timer.h +++ b/sysdeps/pthread/posix-timer.h @@ -115,7 +115,8 @@ timer_delref (struct timer_node *timer) /* Timespec helper routines. */ static inline int __attribute ((always_inline)) -__timespec_compare (const struct timespec *left, const struct timespec *right) +__timespec_compare (const struct __timespec64 *left, + const struct __timespec64 *right) { if (left->tv_sec < right->tv_sec) return -1; @@ -131,8 +132,8 @@ __timespec_compare (const struct timespec *left, const struct timespec *right) } static inline void -__timespec_add (struct timespec *sum, const struct timespec *left, - const struct timespec *right) +__timespec_add (struct __timespec64 *sum, const struct __timespec64 *left, + const struct __timespec64 *right) { sum->tv_sec = left->tv_sec + right->tv_sec; sum->tv_nsec = left->tv_nsec + right->tv_nsec; @@ -145,8 +146,8 @@ __timespec_add (struct timespec *sum, const struct timespec *left, } static inline void -__timespec_sub (struct timespec *diff, const struct timespec *left, - const struct timespec *right) +__timespec_sub (struct __timespec64 *diff, const struct __timespec64 *left, + const struct __timespec64 *right) { diff->tv_sec = left->tv_sec - right->tv_sec; diff->tv_nsec = left->tv_nsec - right->tv_nsec;