1 | /* ABI compatibility redirects for clock_* symbols in librt. |
2 | Copyright (C) 2012-2019 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. |
4 | |
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. |
9 | |
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. |
14 | |
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/>. */ |
18 | |
19 | #include <shlib-compat.h> |
20 | |
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. */ |
25 | |
26 | #if SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_17) |
27 | |
28 | #include <time.h> |
29 | |
30 | #if HAVE_IFUNC |
31 | # undef INIT_ARCH |
32 | # define INIT_ARCH() |
33 | # define COMPAT_REDIRECT(name, proto, arglist) libc_ifunc (name, &__##name) \ |
34 | compat_symbol (librt, name, name, GLIBC_2_2); |
35 | #else |
36 | # define COMPAT_REDIRECT(name, proto, arglist) \ |
37 | int \ |
38 | name proto \ |
39 | { \ |
40 | return __##name arglist; \ |
41 | } \ |
42 | compat_symbol (librt, name, name, GLIBC_2_2); |
43 | #endif |
44 | |
45 | COMPAT_REDIRECT (clock_getres, |
46 | (clockid_t clock_id, struct timespec *res), |
47 | (clock_id, res)) |
48 | COMPAT_REDIRECT (clock_gettime, |
49 | (clockid_t clock_id, struct timespec *tp), |
50 | (clock_id, tp)) |
51 | COMPAT_REDIRECT (clock_settime, |
52 | (clockid_t clock_id, const struct timespec *tp), |
53 | (clock_id, tp)) |
54 | COMPAT_REDIRECT (clock_getcpuclockid, |
55 | (pid_t pid, clockid_t *clock_id), |
56 | (pid, clock_id)) |
57 | COMPAT_REDIRECT (clock_nanosleep, |
58 | (clockid_t clock_id, int flags, |
59 | const struct timespec *req, |
60 | struct timespec *rem), |
61 | (clock_id, flags, req, rem)) |
62 | |
63 | #endif |
64 | |