mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-01 10:06:57 +03:00
Cleanup clock_*time includes
Clock_gettime, settime and getres implementations are unncessarily complex due to using defines and C file inclusion. Simplify the code by replacing the redundant defines and removing the inclusion, making it much easier to understand. No functional changes. * sysdeps/posix/clock_getres.c (__clock_getres): Cleanup. * sysdeps/unix/clock_gettime.c (__clock_gettime): Cleanup. * sysdeps/unix/clock_settime.c (__clock_settime): Cleanup. * sysdeps/unix/sysv/linux/clock_getres.c (__clock_getres): Cleanup. * sysdeps/unix/sysv/linux/clock_gettime.c (__clock_gettime): Cleanup. * sysdeps/unix/sysv/linux/clock_settime.c (__clock_settime): Cleanup.
This commit is contained in:
@ -21,18 +21,17 @@
|
||||
|
||||
#include "kernel-posix-cpu-timers.h"
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
/* 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>
|
||||
return INLINE_SYSCALL_CALL (clock_settime, clock_id, tp);
|
||||
}
|
||||
weak_alias (__clock_settime, clock_settime)
|
||||
|
Reference in New Issue
Block a user