about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/timer_gettime.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-06-28 09:51:01 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-06-28 09:51:01 +0200
commita1d6ed027b7f3ee603fba77c16508c7edc78d00a (patch)
tree82263a780b938b5173d5b47d2acfd3f1a97f5be6 /sysdeps/unix/sysv/linux/timer_gettime.c
parentdf6d227e69082c5cab33b60aa676aebf08b7585e (diff)
downloadglibc-a1d6ed027b7f3ee603fba77c16508c7edc78d00a.tar.gz
glibc-a1d6ed027b7f3ee603fba77c16508c7edc78d00a.tar.xz
glibc-a1d6ed027b7f3ee603fba77c16508c7edc78d00a.zip
Linux: Move timer_gettime, __timer_gettime64 from librt to libc
The symbols were moved using scripts/move-symbol-to-libc.py.

The way the ABI intransition is implemented is changed with this
commit: the implementation is now consolidated in one file with a
TIMER_T_WAS_INT_COMPAT check.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps/unix/sysv/linux/timer_gettime.c')
-rw-r--r--sysdeps/unix/sysv/linux/timer_gettime.c63
1 files changed, 53 insertions, 10 deletions
diff --git a/sysdeps/unix/sysv/linux/timer_gettime.c b/sysdeps/unix/sysv/linux/timer_gettime.c
index 193fe3b140..a0537060c8 100644
--- a/sysdeps/unix/sysv/linux/timer_gettime.c
+++ b/sysdeps/unix/sysv/linux/timer_gettime.c
@@ -22,17 +22,19 @@
 #include <sysdep.h>
 #include <kernel-features.h>
 #include "kernel-posix-timers.h"
+#include <shlib-compat.h>
 
+#if !TIMER_T_WAS_INT_COMPAT
 int
-__timer_gettime64 (timer_t timerid, struct __itimerspec64 *value)
+___timer_gettime64 (timer_t timerid, struct __itimerspec64 *value)
 {
   kernel_timer_t ktimerid = timerid_to_kernel_timer (timerid);
 
-#ifndef __NR_timer_gettime64
-# define __NR_timer_gettime64 __NR_timer_gettime
-#endif
+# ifndef __NR_timer_gettime64
+#  define __NR_timer_gettime64 __NR_timer_gettime
+# endif
   int ret = INLINE_SYSCALL_CALL (timer_gettime64, ktimerid, value);
-#ifndef __ASSUME_TIME64_SYSCALLS
+# ifndef __ASSUME_TIME64_SYSCALLS
   if (ret == 0 || errno != ENOSYS)
     return ret;
 
@@ -43,12 +45,19 @@ __timer_gettime64 (timer_t timerid, struct __itimerspec64 *value)
       value->it_interval = valid_timespec_to_timespec64 (its32.it_interval);
       value->it_value = valid_timespec_to_timespec64 (its32.it_value);
     }
-#endif
+# endif
   return ret;
 }
 
-#if __TIMESIZE != 64
-librt_hidden_def (__timer_gettime64)
+# if __TIMESIZE == 64
+versioned_symbol (libc, ___timer_gettime64, timer_gettime, GLIBC_2_34);
+#  if OTHER_SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_34)
+compat_symbol (librt, ___timer_gettime64, timer_gettime, GLIBC_2_2);
+#  endif
+
+# else /* __TIMESIZE != 64 */
+libc_hidden_ver (___timer_gettime64, __timer_gettime64)
+versioned_symbol (libc, ___timer_gettime64, __timer_gettime64, GLIBC_2_34);
 
 int
 __timer_gettime (timer_t timerid, struct itimerspec *value)
@@ -63,5 +72,39 @@ __timer_gettime (timer_t timerid, struct itimerspec *value)
 
   return retval;
 }
-#endif
-weak_alias (__timer_gettime, timer_gettime)
+versioned_symbol (libc, __timer_gettime, timer_gettime, GLIBC_2_34);
+
+#  if OTHER_SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_34)
+compat_symbol (librt, __timer_gettime, timer_gettime, GLIBC_2_2);
+#  endif
+# endif /* __TIMESIZE != 64 */
+
+#else /* TIMER_T_WAS_INT_COMPAT */
+
+extern __typeof (timer_gettime) __timer_gettime_new;
+libc_hidden_proto (__timer_gettime_new)
+
+int
+___timer_gettime_new (timer_t timerid, struct itimerspec *value)
+{
+  kernel_timer_t ktimerid = timerid_to_kernel_timer (timerid);
+
+  return INLINE_SYSCALL_CALL (timer_gettime, ktimerid, value);
+}
+versioned_symbol (libc, ___timer_gettime_new, timer_gettime, GLIBC_2_34);
+libc_hidden_ver (___timer_gettime_new, __timer_gettime_new)
+
+# if OTHER_SHLIB_COMPAT (librt, GLIBC_2_3_3, GLIBC_2_34)
+compat_symbol (librt, ___timer_gettime_new, timer_gettime, GLIBC_2_3_3);
+# endif
+
+# if OTHER_SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_3_3)
+int
+__timer_gettime_old (int timerid, struct itimerspec *value)
+{
+  return __timer_gettime_new (__timer_compat_list[timerid], value);
+}
+compat_symbol (librt, __timer_gettime_old, timer_gettime, GLIBC_2_2);
+# endif
+
+#endif /* TIMER_T_WAS_INT_COMPAT */