aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux')
-rw-r--r--sysdeps/unix/sysv/linux/clock_getres.c30
-rw-r--r--sysdeps/unix/sysv/linux/clock_gettime.c27
-rw-r--r--sysdeps/unix/sysv/linux/clock_settime.c29
3 files changed, 29 insertions, 57 deletions
diff --git a/sysdeps/unix/sysv/linux/clock_getres.c b/sysdeps/unix/sysv/linux/clock_getres.c
index a245328..24b2299 100644
--- a/sysdeps/unix/sysv/linux/clock_getres.c
+++ b/sysdeps/unix/sysv/linux/clock_getres.c
@@ -26,26 +26,10 @@
#endif
#include <sysdep-vdso.h>
-#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>
+/* Get resolution of clock. */
+int
+__clock_getres (clockid_t clock_id, struct timespec *res)
+{
+ return INLINE_VSYSCALL (clock_getres, 2, clock_id, res);
+}
+weak_alias (__clock_getres, clock_getres)
diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c
index 9af806f..5fc47fb 100644
--- a/sysdeps/unix/sysv/linux/clock_gettime.c
+++ b/sysdeps/unix/sysv/linux/clock_gettime.c
@@ -26,22 +26,11 @@
#endif
#include <sysdep-vdso.h>
-/* The REALTIME and MONOTONIC clock are definitely supported in the
- kernel. */
-#define SYSDEP_GETTIME \
- SYSDEP_GETTIME_CPUTIME; \
- case CLOCK_REALTIME: \
- case CLOCK_MONOTONIC: \
- retval = INLINE_VSYSCALL (clock_gettime, 2, clock_id, tp); \
- break
-
-/* We handled the REALTIME clock here. */
-#define HANDLED_REALTIME 1
-#define HANDLED_CPUTIME 1
-
-#define SYSDEP_GETTIME_CPU(clock_id, tp) \
- retval = INLINE_VSYSCALL (clock_gettime, 2, clock_id, tp); \
- break
-#define SYSDEP_GETTIME_CPUTIME /* Default catches them too. */
-
-#include <sysdeps/unix/clock_gettime.c>
+/* Get current value of CLOCK and store it in TP. */
+int
+__clock_gettime (clockid_t clock_id, struct timespec *tp)
+{
+ return INLINE_VSYSCALL (clock_gettime, 2, clock_id, tp);
+}
+weak_alias (__clock_gettime, clock_gettime)
+libc_hidden_def (__clock_gettime)
diff --git a/sysdeps/unix/sysv/linux/clock_settime.c b/sysdeps/unix/sysv/linux/clock_settime.c
index 7e2432b..d837e30 100644
--- a/sysdeps/unix/sysv/linux/clock_settime.c
+++ b/sysdeps/unix/sysv/linux/clock_settime.c
@@ -21,18 +21,17 @@
#include "kernel-posix-cpu-timers.h"
-
-/* The REALTIME clock is definitely supported in the kernel. */
-#define SYSDEP_SETTIME \
- case CLOCK_REALTIME: \
- retval = INLINE_SYSCALL (clock_settime, 2, clock_id, tp); \
- break
-
-/* We handled the REALTIME clock here. */
-#define HANDLED_REALTIME 1
-
-#define HANDLED_CPUTIME 1
-#define SYSDEP_SETTIME_CPU \
- retval = INLINE_SYSCALL (clock_settime, 2, clock_id, tp)
-
-#include <sysdeps/unix/clock_settime.c>
+/* Set CLOCK to value TP. */
+int
+__clock_settime (clockid_t clock_id, const struct timespec *tp)
+{
+ /* Make sure the time cvalue is OK. */
+ if (tp->tv_nsec < 0 || tp->tv_nsec >= 1000000000)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ return INLINE_SYSCALL_CALL (clock_settime, clock_id, tp);
+}
+weak_alias (__clock_settime, clock_settime)