Blame rt/clock-compat.c

Packit Service c82647
/* ABI compatibility redirects for clock_* symbols in librt.
Packit Service c82647
   Copyright (C) 2012-2018 Free Software Foundation, Inc.
Packit Service c82647
   This file is part of the GNU C Library.
Packit Service c82647
Packit Service c82647
   The GNU C Library is free software; you can redistribute it and/or
Packit Service c82647
   modify it under the terms of the GNU Lesser General Public
Packit Service c82647
   License as published by the Free Software Foundation; either
Packit Service c82647
   version 2.1 of the License, or (at your option) any later version.
Packit Service c82647
Packit Service c82647
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service c82647
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service c82647
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service c82647
   Lesser General Public License for more details.
Packit Service c82647
Packit Service c82647
   You should have received a copy of the GNU Lesser General Public
Packit Service c82647
   License along with the GNU C Library; if not, see
Packit Service c82647
   <http://www.gnu.org/licenses/>.  */
Packit Service c82647
Packit Service c82647
#include <shlib-compat.h>
Packit Service c82647
Packit Service c82647
/* The clock_* symbols were originally defined in librt and so
Packit Service c82647
   are part of its ABI.  As of 2.17, they have moved to libc.
Packit Service c82647
   So we supply definitions for librt that just redirect to
Packit Service c82647
   their libc counterparts.  */
Packit Service c82647
Packit Service c82647
#if SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_17)
Packit Service c82647
Packit Service c82647
#include <time.h>
Packit Service c82647
Packit Service c82647
#if HAVE_IFUNC
Packit Service c82647
# undef INIT_ARCH
Packit Service c82647
# define INIT_ARCH()
Packit Service 3f5bfc
# define COMPAT_REDIRECT(name, proto, arglist) libc_ifunc (name, &__##name) \
Packit Service 3f5bfc
    compat_symbol (librt, name, name, GLIBC_2_2);
Packit Service c82647
#else
Packit Service c82647
# define COMPAT_REDIRECT(name, proto, arglist)				      \
Packit Service c82647
  int									      \
Packit Service c82647
  name proto								      \
Packit Service c82647
  {									      \
Packit Service c82647
    return __##name arglist;						      \
Packit Service 3f5bfc
  }									      \
Packit Service 3f5bfc
  compat_symbol (librt, name, name, GLIBC_2_2);
Packit Service c82647
#endif
Packit Service c82647
Packit Service c82647
COMPAT_REDIRECT (clock_getres,
Packit Service c82647
		 (clockid_t clock_id, struct timespec *res),
Packit Service c82647
		 (clock_id, res))
Packit Service c82647
COMPAT_REDIRECT (clock_gettime,
Packit Service c82647
		 (clockid_t clock_id, struct timespec *tp),
Packit Service c82647
		 (clock_id, tp))
Packit Service c82647
COMPAT_REDIRECT (clock_settime,
Packit Service c82647
		 (clockid_t clock_id, const struct timespec *tp),
Packit Service c82647
		 (clock_id, tp))
Packit Service c82647
COMPAT_REDIRECT (clock_getcpuclockid,
Packit Service c82647
		 (pid_t pid, clockid_t *clock_id),
Packit Service c82647
		 (pid, clock_id))
Packit Service c82647
COMPAT_REDIRECT (clock_nanosleep,
Packit Service c82647
		 (clockid_t clock_id, int flags,
Packit Service c82647
		  const struct timespec *req,
Packit Service c82647
		  struct timespec *rem),
Packit Service c82647
		 (clock_id, flags, req, rem))
Packit Service c82647
Packit Service c82647
#endif