Commit 03baa08b authored by Philippe Gerum's avatar Philippe Gerum
Browse files

lib/clock: move evl_read_clock() out of line



What evl_read_clock() does is non-trivial, enough to call for an out
of line implementation.

In general, refrain from inlining core services, so that interposing
on them via dynamic linking tricks is made easier.
Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <rpm@xenomai.org>
parent 455b4f17
......@@ -18,19 +18,7 @@
extern "C" {
#endif
static inline
int evl_read_clock(int clockfd, struct timespec *tp)
{
extern int (*arch_clock_gettime)(clockid_t clk_id,
struct timespec *tp);
switch (clockfd) {
case -CLOCK_MONOTONIC:
case -CLOCK_REALTIME:
return arch_clock_gettime(-clockfd, tp) ? -errno : 0;
default:
return oob_ioctl(clockfd, EVL_CLKIOC_GET_TIME, tp) ? -errno : 0;
}
}
int evl_read_clock(int clockfd, struct timespec *tp);
int evl_set_clock(int clockfd, const struct timespec *tp);
......
......@@ -18,6 +18,17 @@
int evl_mono_clockfd = -ENXIO,
evl_real_clockfd = -ENXIO;
int evl_read_clock(int clockfd, struct timespec *tp)
{
switch (clockfd) {
case -CLOCK_MONOTONIC:
case -CLOCK_REALTIME:
return arch_clock_gettime(-clockfd, tp) ? -errno : 0;
default:
return oob_ioctl(clockfd, EVL_CLKIOC_GET_TIME, tp) ? -errno : 0;
}
}
int evl_set_clock(int clockfd, const struct timespec *tp)
{
struct __evl_timespec kts;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment