Revert "Patch [1/4] async-signal safe TLS."
[glibc.git] / rt / clock-compat.c
blob1ccc2965e220a74ef4e128df6575c784c6e0eb98
1 /* ABI compatibility redirects for clock_* symbols in librt.
2 Copyright (C) 2012-2014 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
19 #include <shlib-compat.h>
21 /* The clock_* symbols were originally defined in librt and so
22 are part of its ABI. As of 2.17, they have moved to libc.
23 So we supply definitions for librt that just redirect to
24 their libc counterparts. */
26 #if SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_17)
28 #include <time.h>
30 #ifdef HAVE_IFUNC
31 # define COMPAT_REDIRECT(name, proto, arglist) \
32 __typeof (name) *name##_ifunc (void) asm (#name); \
33 __typeof (name) *name##_ifunc (void) \
34 { \
35 return &__##name; \
36 } \
37 asm (".type " #name ", %gnu_indirect_function");
38 #else
39 # define COMPAT_REDIRECT(name, proto, arglist) \
40 int \
41 name proto \
42 { \
43 return __##name arglist; \
45 #endif
47 COMPAT_REDIRECT (clock_getres,
48 (clockid_t clock_id, struct timespec *res),
49 (clock_id, res))
50 COMPAT_REDIRECT (clock_gettime,
51 (clockid_t clock_id, struct timespec *tp),
52 (clock_id, tp))
53 COMPAT_REDIRECT (clock_settime,
54 (clockid_t clock_id, const struct timespec *tp),
55 (clock_id, tp))
56 COMPAT_REDIRECT (clock_getcpuclockid,
57 (pid_t pid, clockid_t *clock_id),
58 (pid, clock_id))
59 COMPAT_REDIRECT (clock_nanosleep,
60 (clockid_t clock_id, int flags,
61 const struct timespec *req,
62 struct timespec *rem),
63 (clock_id, flags, req, rem))
65 #endif