[RFC,06/12] y2038: Rename timespec_sub to __timespec_sub

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

Commit Message

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

Patch

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
 	{