* [PATCH 4/4] [y2038] lib: cobalt: clock: dispatch clock_settime
@ 2021-03-11 2:47 chensong
2021-03-11 9:39 ` florian.bezdeka
0 siblings, 1 reply; 2+ messages in thread
From: chensong @ 2021-03-11 2:47 UTC (permalink / raw)
To: florian.bezdeka, xenomai, rpm
If sizeof time_t bigger than 4, which means glibc supports
64bit timespec, and __xn_feat_time64 is available in kernel,
go to clock_settime64.
otherwise, go to original clock_settime.
Signed-off-by: chensong <chensong@tj.kylinos.cn>
---
lib/cobalt/clock.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/cobalt/clock.c b/lib/cobalt/clock.c
index 8f06320..843ecd4 100644
--- a/lib/cobalt/clock.c
+++ b/lib/cobalt/clock.c
@@ -276,7 +276,13 @@ COBALT_IMPL(int, clock_settime, (clockid_t clock_id, const struct timespec *tp))
if (clock_id == CLOCK_REALTIME && !cobalt_use_legacy_tsc())
return __STD(clock_settime(CLOCK_REALTIME, tp));
+#ifdef __USE_TIME_BITS64
+ ret = -XENOMAI_SYSCALL2((cobalt_features_available(__xn_feat_time64)) ?
+ sc_cobalt_clock_settime64 : sc_cobalt_clock_settime,
+ clock_id, tp);
+#else
ret = -XENOMAI_SYSCALL2(sc_cobalt_clock_settime, clock_id, tp);
+#endif
if (ret) {
errno = ret;
return -1;
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 4/4] [y2038] lib: cobalt: clock: dispatch clock_settime
2021-03-11 2:47 [PATCH 4/4] [y2038] lib: cobalt: clock: dispatch clock_settime chensong
@ 2021-03-11 9:39 ` florian.bezdeka
0 siblings, 0 replies; 2+ messages in thread
From: florian.bezdeka @ 2021-03-11 9:39 UTC (permalink / raw)
To: rpm, xenomai, chensong
On Thu, 2021-03-11 at 10:47 +0800, chensong wrote:
> If sizeof time_t bigger than 4, which means glibc supports
> 64bit timespec, and __xn_feat_time64 is available in kernel,
> go to clock_settime64.
>
> otherwise, go to original clock_settime.
>
> Signed-off-by: chensong <chensong@tj.kylinos.cn>
> ---
> lib/cobalt/clock.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/lib/cobalt/clock.c b/lib/cobalt/clock.c
> index 8f06320..843ecd4 100644
> --- a/lib/cobalt/clock.c
> +++ b/lib/cobalt/clock.c
> @@ -276,7 +276,13 @@ COBALT_IMPL(int, clock_settime, (clockid_t clock_id, const struct timespec *tp))
> if (clock_id == CLOCK_REALTIME && !cobalt_use_legacy_tsc())
> return __STD(clock_settime(CLOCK_REALTIME, tp));
>
> +#ifdef __USE_TIME_BITS64
> + ret = -XENOMAI_SYSCALL2((cobalt_features_available(__xn_feat_time64)) ?
> + sc_cobalt_clock_settime64 : sc_cobalt_clock_settime,
> + clock_id, tp);
We don't have a __xn_feat_time64 feature flag. If the syscall is not
available we get ENOSYS which tells the caller that the feature is not
available.
Falling back to sc_cobalt_clock_settime is a bug anyways.
> +#else
> ret = -XENOMAI_SYSCALL2(sc_cobalt_clock_settime, clock_id, tp);
> +#endif
> if (ret) {
> errno = ret;
> return -1;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-11 9:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-11 2:47 [PATCH 4/4] [y2038] lib: cobalt: clock: dispatch clock_settime chensong
2021-03-11 9:39 ` florian.bezdeka
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.