]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - sysdeps/unix/sysv/linux/clock_getres.c
Finish move of clock_* functions to libc. [BZ #24959]
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / clock_getres.c
index 7941a5a8dd9eb97debcdc4568ac015cb4fb94a4a..18a7ce53c0a4e3c3e495fff9159cdae9b64edad9 100644 (file)
@@ -1,5 +1,5 @@
 /* clock_getres -- Get the resolution of a POSIX clockid_t.  Linux version.
-   Copyright (C) 2003-2013 Free Software Foundation, Inc.
+   Copyright (C) 2003-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
 #include <errno.h>
 #include <time.h>
 #include "kernel-posix-cpu-timers.h"
-#include <kernel-features.h>
-
-#ifndef HAVE_CLOCK_GETRES_VSYSCALL
-# undef INTERNAL_VSYSCALL
-# define INTERNAL_VSYSCALL INTERNAL_SYSCALL
-# undef INLINE_VSYSCALL
-# define INLINE_VSYSCALL INLINE_SYSCALL
-#else
-# include <bits/libc-vdso.h>
-#endif
 
-#define SYSCALL_GETRES \
-  retval = INLINE_VSYSCALL (clock_getres, 2, clock_id, res); \
-  break
-
-/* The REALTIME and MONOTONIC clock are definitely supported in the
-   kernel.  */
-#define SYSDEP_GETRES                                                        \
-  SYSDEP_GETRES_CPUTIME                                                              \
-  case CLOCK_REALTIME:                                                       \
-  case CLOCK_MONOTONIC:                                                              \
-  case CLOCK_MONOTONIC_RAW:                                                  \
-  case CLOCK_REALTIME_COARSE:                                                \
-  case CLOCK_MONOTONIC_COARSE:                                               \
-    SYSCALL_GETRES
-
-/* We handled the REALTIME clock here.  */
-#define HANDLED_REALTIME       1
-#define HANDLED_CPUTIME                1
-
-#define SYSDEP_GETRES_CPU SYSCALL_GETRES
-#define SYSDEP_GETRES_CPUTIME  /* Default catches them too.  */
-
-#include <sysdeps/posix/clock_getres.c>
+#ifdef HAVE_CLOCK_GETRES_VSYSCALL
+# define HAVE_VSYSCALL
+#endif
+#include <sysdep-vdso.h>
+
+#include <shlib-compat.h>
+
+/* Get resolution of clock.  */
+int
+__clock_getres (clockid_t clock_id, struct timespec *res)
+{
+  return INLINE_VSYSCALL (clock_getres, 2, clock_id, res);
+}
+
+versioned_symbol (libc, __clock_getres, clock_getres, GLIBC_2_17);
+/* clock_getres moved to libc in version 2.17;
+   old binaries may expect the symbol version it had in librt.  */
+#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
+strong_alias (__clock_getres, __clock_getres_2);
+compat_symbol (libc, __clock_getres_2, clock_getres, GLIBC_2_2);
+#endif