diff options
author | Roland McGrath <roland@hack.frob.com> | 2014-05-14 10:35:39 -0700 |
---|---|---|
committer | Roland McGrath <roland@hack.frob.com> | 2014-05-14 10:35:39 -0700 |
commit | 3a51fb604715776e051691c65e360bdf7d37488e (patch) | |
tree | ba32aeb55c28460018802691e0b58ecc52ce6a17 /sysdeps/unix/sysv/linux/x86_64 | |
parent | 941d7dfd247bc116b89ec97d530d618b5862a80f (diff) | |
download | glibc-3a51fb604715776e051691c65e360bdf7d37488e.tar.gz glibc-3a51fb604715776e051691c65e360bdf7d37488e.tar.xz glibc-3a51fb604715776e051691c65e360bdf7d37488e.zip |
Move x86_64 timer_*.c out of nptl/
Diffstat (limited to 'sysdeps/unix/sysv/linux/x86_64')
-rw-r--r-- | sysdeps/unix/sysv/linux/x86_64/Versions | 8 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/x86_64/timer_create.c | 65 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/x86_64/timer_delete.c | 44 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/x86_64/timer_getoverr.c | 38 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/x86_64/timer_gettime.c | 37 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/x86_64/timer_settime.c | 39 |
6 files changed, 231 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/x86_64/Versions b/sysdeps/unix/sysv/linux/x86_64/Versions index 34c100bfd2..4ce7b78af4 100644 --- a/sysdeps/unix/sysv/linux/x86_64/Versions +++ b/sysdeps/unix/sysv/linux/x86_64/Versions @@ -10,3 +10,11 @@ libc { __vdso_clock_gettime; } } + +librt { + GLIBC_2.3.3 { + # Changed timer_t. + timer_create; timer_delete; timer_getoverrun; timer_gettime; + timer_settime; + } +} diff --git a/sysdeps/unix/sysv/linux/x86_64/timer_create.c b/sysdeps/unix/sysv/linux/x86_64/timer_create.c new file mode 100644 index 0000000000..a1209f9f0b --- /dev/null +++ b/sysdeps/unix/sysv/linux/x86_64/timer_create.c @@ -0,0 +1,65 @@ +/* Copyright (C) 2003-2014 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2003. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see <http://www.gnu.org/licenses/>. */ + +#include <shlib-compat.h> +#include "compat-timer.h" +#include <atomic.h> + + +#define timer_create_alias __timer_create_new +#include <sysdeps/unix/sysv/linux/timer_create.c> + +#undef timer_create +versioned_symbol (librt, __timer_create_new, timer_create, GLIBC_2_3_3); + + +#if SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_3_3) +timer_t __compat_timer_list[OLD_TIMER_MAX] attribute_hidden; + + +int +__timer_create_old (clockid_t clock_id, struct sigevent *evp, int *timerid) +{ + timer_t newp; + + int res = __timer_create_new (clock_id, evp, &newp); + if (res == 0) + { + int i; + for (i = 0; i < OLD_TIMER_MAX; ++i) + if (__compat_timer_list[i] == NULL + && ! atomic_compare_and_exchange_bool_acq (&__compat_timer_list[i], + newp, NULL)) + { + *timerid = i; + break; + } + + if (__glibc_unlikely (i == OLD_TIMER_MAX)) + { + /* No free slot. */ + (void) __timer_delete_new (newp); + __set_errno (EINVAL); + res = -1; + } + } + + return res; +} +compat_symbol (librt, __timer_create_old, timer_create, GLIBC_2_2); +#endif diff --git a/sysdeps/unix/sysv/linux/x86_64/timer_delete.c b/sysdeps/unix/sysv/linux/x86_64/timer_delete.c new file mode 100644 index 0000000000..25861b7e9e --- /dev/null +++ b/sysdeps/unix/sysv/linux/x86_64/timer_delete.c @@ -0,0 +1,44 @@ +/* Copyright (C) 2003-2014 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2003. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see <http://www.gnu.org/licenses/>. */ + +#include <shlib-compat.h> +#include "compat-timer.h" + + +#define timer_delete_alias __timer_delete_new +#include <sysdeps/unix/sysv/linux/timer_delete.c> + +#undef timer_delete +versioned_symbol (librt, __timer_delete_new, timer_delete, GLIBC_2_3_3); + + +#if SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_3_3) +int +__timer_delete_old (int timerid) +{ + int res = __timer_delete_new (__compat_timer_list[timerid]); + + if (res == 0) + /* Successful timer deletion, now free the index. We only need to + store a word and that better be atomic. */ + __compat_timer_list[timerid] = NULL; + + return res; +} +compat_symbol (librt, __timer_delete_old, timer_delete, GLIBC_2_2); +#endif diff --git a/sysdeps/unix/sysv/linux/x86_64/timer_getoverr.c b/sysdeps/unix/sysv/linux/x86_64/timer_getoverr.c new file mode 100644 index 0000000000..7f45000080 --- /dev/null +++ b/sysdeps/unix/sysv/linux/x86_64/timer_getoverr.c @@ -0,0 +1,38 @@ +/* Copyright (C) 2003-2014 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2003. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see <http://www.gnu.org/licenses/>. */ + +#include <shlib-compat.h> +#include "compat-timer.h" + + +#define timer_getoverrun_alias __timer_getoverrun_new +#include <sysdeps/unix/sysv/linux/timer_getoverr.c> + +#undef timer_getoverrun +versioned_symbol (librt, __timer_getoverrun_new, timer_getoverrun, + GLIBC_2_3_3); + + +#if SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_3_3) +int +__timer_getoverrun_old (int timerid) +{ + return __timer_getoverrun_new (__compat_timer_list[timerid]); +} +compat_symbol (librt, __timer_getoverrun_old, timer_getoverrun, GLIBC_2_2); +#endif diff --git a/sysdeps/unix/sysv/linux/x86_64/timer_gettime.c b/sysdeps/unix/sysv/linux/x86_64/timer_gettime.c new file mode 100644 index 0000000000..7df4804fdf --- /dev/null +++ b/sysdeps/unix/sysv/linux/x86_64/timer_gettime.c @@ -0,0 +1,37 @@ +/* Copyright (C) 2003-2014 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2003. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see <http://www.gnu.org/licenses/>. */ + +#include <shlib-compat.h> +#include "compat-timer.h" + + +#define timer_gettime_alias __timer_gettime_new +#include <sysdeps/unix/sysv/linux/timer_gettime.c> + +#undef timer_gettime +versioned_symbol (librt, __timer_gettime_new, timer_gettime, GLIBC_2_3_3); + + +#if SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_3_3) +int +__timer_gettime_old (int timerid, struct itimerspec *value) +{ + return __timer_gettime_new (__compat_timer_list[timerid], value); +} +compat_symbol (librt, __timer_gettime_old, timer_gettime, GLIBC_2_2); +#endif diff --git a/sysdeps/unix/sysv/linux/x86_64/timer_settime.c b/sysdeps/unix/sysv/linux/x86_64/timer_settime.c new file mode 100644 index 0000000000..399ff835b0 --- /dev/null +++ b/sysdeps/unix/sysv/linux/x86_64/timer_settime.c @@ -0,0 +1,39 @@ +/* Copyright (C) 2003-2014 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2003. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see <http://www.gnu.org/licenses/>. */ + +#include <shlib-compat.h> +#include "compat-timer.h" + + +#define timer_settime_alias __timer_settime_new +#include <sysdeps/unix/sysv/linux/timer_settime.c> + +#undef timer_settime +versioned_symbol (librt, __timer_settime_new, timer_settime, GLIBC_2_3_3); + + +#if SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_3_3) +int +__timer_settime_old (int timerid, int flags, const struct itimerspec *value, + struct itimerspec *ovalue) +{ + return __timer_settime_new (__compat_timer_list[timerid], flags, + value, ovalue); +} +compat_symbol (librt, __timer_settime_old, timer_settime, GLIBC_2_2); +#endif |