Fix ChangeLog formatting
[glibc.git] / rt / clock-compat.c
blobf816973c05c29d5d3c731b2e83c4d25ade658cb2
1 /* ABI compatibility redirects for clock_* symbols in librt.
2 Copyright (C) 2012-2018 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 #if HAVE_IFUNC
31 # undef INIT_ARCH
32 # define INIT_ARCH()
33 # define COMPAT_REDIRECT(name, proto, arglist) libc_ifunc (name, &__##name)
34 #else
35 # define COMPAT_REDIRECT(name, proto, arglist) \
36 int \
37 name proto \
38 { \
39 return __##name arglist; \
41 #endif
43 COMPAT_REDIRECT (clock_getres,
44 (clockid_t clock_id, struct timespec *res),
45 (clock_id, res))
46 COMPAT_REDIRECT (clock_gettime,
47 (clockid_t clock_id, struct timespec *tp),
48 (clock_id, tp))
49 COMPAT_REDIRECT (clock_settime,
50 (clockid_t clock_id, const struct timespec *tp),
51 (clock_id, tp))
52 COMPAT_REDIRECT (clock_getcpuclockid,
53 (pid_t pid, clockid_t *clock_id),
54 (pid, clock_id))
55 COMPAT_REDIRECT (clock_nanosleep,
56 (clockid_t clock_id, int flags,
57 const struct timespec *req,
58 struct timespec *rem),
59 (clock_id, flags, req, rem))
61 #endif