1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +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:
Wilco Dijkstra
2019-02-01 12:19:42 +00:00
parent 83d1cc42d8
commit b06f4c0094
7 changed files with 45 additions and 97 deletions

View File

@ -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)