aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/timer_delete.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-06-28 09:51:00 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-06-28 09:51:00 +0200
commit273a2a2ae8b097672cdc8e9888548b134955af42 (patch)
treea944110b3bfa9a0578aea7c5fc1994d801aee719 /sysdeps/unix/sysv/linux/timer_delete.c
parentd7d0efec47e76c022c3bcb30cdb4b0501d7a9b2a (diff)
downloadglibc-273a2a2ae8b097672cdc8e9888548b134955af42.tar
glibc-273a2a2ae8b097672cdc8e9888548b134955af42.tar.gz
glibc-273a2a2ae8b097672cdc8e9888548b134955af42.tar.bz2
glibc-273a2a2ae8b097672cdc8e9888548b134955af42.zip
Linux: Move timer_create, timer_delete from librt to libc
The symbols were moved using scripts/move-symbol-to-libc.py. timer_create and timer_delete are tied together via the int/timer_t compatibility code. 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_delete.c')
-rw-r--r--sysdeps/unix/sysv/linux/timer_delete.c46
1 files changed, 36 insertions, 10 deletions
diff --git a/sysdeps/unix/sysv/linux/timer_delete.c b/sysdeps/unix/sysv/linux/timer_delete.c
index a7a183591e..c068ca4c41 100644
--- a/sysdeps/unix/sysv/linux/timer_delete.c
+++ b/sysdeps/unix/sysv/linux/timer_delete.c
@@ -21,17 +21,12 @@
#include <time.h>
#include <sysdep.h>
#include "kernel-posix-timers.h"
-
-
-#ifdef timer_delete_alias
-# define timer_delete timer_delete_alias
-#endif
-
+#include <pthreadP.h>
+#include <shlib-compat.h>
int
-timer_delete (timer_t timerid)
+___timer_delete (timer_t timerid)
{
-#undef timer_delete
kernel_timer_t ktimerid = timerid_to_kernel_timer (timerid);
int res = INLINE_SYSCALL_CALL (timer_delete, ktimerid);
@@ -42,7 +37,7 @@ timer_delete (timer_t timerid)
struct timer *kt = timerid_to_timer (timerid);
/* Remove the timer from the list. */
- pthread_mutex_lock (&__timer_active_sigev_thread_lock);
+ __pthread_mutex_lock (&__timer_active_sigev_thread_lock);
if (__timer_active_sigev_thread == kt)
__timer_active_sigev_thread = kt->next;
else
@@ -57,7 +52,7 @@ timer_delete (timer_t timerid)
else
prevp = prevp->next;
}
- pthread_mutex_unlock (&__timer_active_sigev_thread_lock);
+ __pthread_mutex_unlock (&__timer_active_sigev_thread_lock);
free (kt);
}
@@ -69,3 +64,34 @@ timer_delete (timer_t timerid)
Return the error. */
return -1;
}
+versioned_symbol (libc, ___timer_delete, timer_delete, GLIBC_2_34);
+libc_hidden_ver (___timer_delete, __timer_delete)
+
+#if TIMER_T_WAS_INT_COMPAT
+# if OTHER_SHLIB_COMPAT (librt, GLIBC_2_3_3, GLIBC_2_34)
+compat_symbol (librt, ___timer_delete, timer_delete, GLIBC_2_3_3);
+#endif
+
+# if OTHER_SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_3_3)
+int
+__timer_delete_old (int timerid)
+{
+ int res = __timer_delete (__timer_compat_list[timerid]);
+
+ if (res == 0)
+ /* Successful timer deletion, now free the index. We only need to
+ store a word and that better be atomic. */
+ __timer_compat_list[timerid] = NULL;
+
+ return res;
+}
+compat_symbol (librt, __timer_delete_old, timer_delete, GLIBC_2_2);
+# endif /* OTHER_SHLIB_COMPAT */
+
+#else /* !TIMER_T_WAS_INT_COMPAT */
+/* The transition from int to timer_t did not change ABI because the
+ type sizes are the same. */
+# if OTHER_SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_34)
+compat_symbol (librt, ___timer_delete, timer_delete, GLIBC_2_2);
+# endif
+#endif /* !TIMER_T_WAS_INT_COMPAT */