1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

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>
This commit is contained in:
Florian Weimer
2021-06-28 09:51:00 +02:00
parent d7d0efec47
commit 273a2a2ae8
90 changed files with 276 additions and 242 deletions

View File

@ -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 */