diff mbox series

[RFC,07/12] y2038: Rename timespec_add to __timespec_add

Message ID 20200601140740.16371-8-lukma@denx.de
State Dropped
Delegated to: Lukasz Majewski
Headers show
Series y2038: Convert timespec_{sub|add|create} in support to be Y2038 safe | expand

Commit Message

Lukasz Majewski June 1, 2020, 2:07 p.m. UTC
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 mbox series

Patch

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 <support/check.h>
 #include <support/xtime.h>
 
-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);