y2038: clock_{g,s}ettime64, clock_nanosleep64
cover y2038: clock_{g,s}ettime64, clock_nanosleep64
Hi!
This is the next set of changes needed for solving the y2038 problem. Most patches were provided by Song. I reviewed them and fixed some error handling problems as well as test failures on some architectures. Some of the tests were rebased on top of the current next branch.
With this series applied the wip/dovetail and florian/y2038 [1] branches are merge-able without conflicts.
Best regards,
Florian
[1] https://gitlab.com/Xenomai/xenomai-hacker-space/-/tree/florian/y2038
Florian Bezdeka (1):
y2038: libcobalt: Centralize sc_cobalt_clock_gettime syscall
chensong (8):
y2038: cobalt/posix/clock: Adding clock_gettime64
y2038: cobalt/posix/clock: Adding clock_settime64
y2038: lib/cobalt/clock: dispatch clock_gettime
y2038: lib/cobalt/clock: dispatch clock_settime
y2038: testsuite/smokey/y2038: testcase for settime64 and gettime64
y2038: cobalt/posix/clock: Adding clock_nanosleep64
y2038: lib/cobalt/clock: dispatch clock_nanosleep
y2038: testsuite/smokey/y2038: Adding testcase for nanosleep64
include/cobalt/kernel/time.h | 11 ++ include/cobalt/uapi/syscall.h | 3 + kernel/cobalt/posix/clock.c | 70 +++++++++++- kernel/cobalt/posix/clock.h | 22 ++++ kernel/cobalt/posix/syscall32.c | 23 ++++ kernel/cobalt/posix/syscall32.h | 14 +++ kernel/cobalt/time.c | 11 ++ lib/cobalt/clock.c | 22 +++- testsuite/smokey/y2038/syscall-tests.c | 151 +++++++++++++++++++++++++ 9 files changed, 324 insertions(+), 3 deletions(-)
Signature · 1 line
2.31.1
PATCH 1/9 y2038: libcobalt: Centralize sc_cobalt_clock_gettime syscall
There were two places invoking the sc_cobalt_clock_gettime syscalls and both places would be updated while introducing y2038 support. To keep y2038 compatibility as simple as possible the code has been moved into a simple helper function.
--- lib/cobalt/clock.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
lib/cobalt/clock.c +7 -2
@@ -149,6 +149,11 @@ static int __do_clock_host_realtime(struct timespec *ts)return 0 ; } +static int __do_clock_gettime (clockid_t clock_id,struct timespec *tp) +{ +return -XENOMAI_SYSCALL2 (sc_cobalt_clock_gettime, clock_id, tp); +} +static int gettime_via_tsc (clockid_t clock_id,struct timespec *tp) {unsigned long rem;
@@ -172,7 +177,7 @@ static int gettime_via_tsc(clockid_t clock_id, struct timespec *tp) tp->tv_nsec = rem;return 0 ;default : - ret = -XENOMAI_SYSCALL2 (sc_cobalt_clock_gettime, clock_id, tp); + ret =__do_clock_gettime (clock_id, tp); }if (ret) {
@@ -197,7 +202,7 @@ static int gettime_via_vdso(clockid_t clock_id, struct timespec *tp) ret =__cobalt_vdso_gettime (clock_id, tp);break ;default : - ret = -XENOMAI_SYSCALL2 (sc_cobalt_clock_gettime, clock_id, tp); + ret =__do_clock_gettime (clock_id, tp); }if (ret) {
Signature · 1 line
2.31.1
PATCH 2/9 y2038: cobalt/posix/clock: Adding clock_gettime64
In reply to Florian BezdekaFrom: chensong <[email protected]>
Add a syscall specific for clock_gettime with 64bit time_t.
--- include/cobalt/kernel/time.h | 11 +++++++++++ include/cobalt/uapi/syscall.h | 1 + kernel/cobalt/posix/clock.c | 23 ++++++++++++++++++++++- kernel/cobalt/posix/clock.h | 6 ++++++ kernel/cobalt/posix/syscall32.c | 7 +++++++ kernel/cobalt/posix/syscall32.h | 4 ++++ kernel/cobalt/time.c | 11 +++++++++++ 7 files changed, 62 insertions(+), 1 deletion(-)
include/cobalt/kernel/time.h +11 -0
@@ -17,4 +17,15 @@int cobalt_get_timespec64 (struct timespec64 *ts,const struct __kernel_timespec __user *uts); +/** +* Covert struct timespec64 to struct __kernel_timespec +* and copy to userspace +* +* @param ts The source, provided by kernel +* @param uts The destination, will be filled +* @return 0 on success, -EFAULT otherwise +*/ +int cobalt_put_timespec64 (const struct timespec64 *ts, +struct __kernel_timespec __user *uts); +#endif //_COBALT_KERNEL_TIME_H
include/cobalt/uapi/syscall.h +1 -0
@@ -123,6 +123,7 @@#define sc_cobalt_clock_adjtime 100#define sc_cobalt_thread_setschedprio 101#define sc_cobalt_sem_timedwait64 102 +#define sc_cobalt_clock_gettime64 103#define __NR_COBALT_SYSCALLS 128/* Power of 2 */
kernel/cobalt/posix/clock.c +22 -1
@@ -23,6 +23,7 @@#include "thread.h" #include "clock.h" #include <trace/events/cobalt-posix.h> +#include <cobalt/kernel/time.h> static struct xnclock *external_clocks[COBALT_MAX_EXTCLOCKS ];
@@ -134,11 +135,31 @@ COBALT_SYSCALL(clock_gettime, current,if (cobalt_put_u_timespec (u_ts, &ts))return -EFAULT ; -trace_cobalt_clock_gettime (clock_id, &ts); +return 0 ; +} + +int __cobalt_clock_gettime64 (clockid_t clock_id, +struct __kernel_timespec __user *u_ts) +{ +struct timespec64 ts; +int ret; + + ret =__cobalt_clock_gettime (clock_id, &ts); +if (ret) +return ret; + +if (cobalt_put_timespec64 (&ts, u_ts)) +return -EFAULT ;return 0 ; } +COBALT_SYSCALL (clock_gettime64, current, + (clockid_t clock_id, struct __kernel_timespec __user *u_ts)) +{ +return __cobalt_clock_gettime64 (clock_id, u_ts); +} +int __cobalt_clock_settime (clockid_t clock_id,const struct timespec64 *ts) {int _ret, ret =0 ;
kernel/cobalt/posix/clock.h +6 -0
@@ -100,6 +100,9 @@ int __cobalt_clock_getres(clockid_t clock_id,int __cobalt_clock_gettime (clockid_t clock_id,struct timespec64 *ts); +int __cobalt_clock_gettime64 (clockid_t clock_id, +struct __kernel_timespec __user *u_ts); +int __cobalt_clock_settime (clockid_t clock_id,const struct timespec64 *ts);
@@ -116,6 +119,9 @@ COBALT_SYSCALL_DECL(clock_getres,COBALT_SYSCALL_DECL (clock_gettime, (clockid_t clock_id, struct __user_old_timespec __user *u_ts)); +COBALT_SYSCALL_DECL (clock_gettime64, + (clockid_t clock_id, struct __kernel_timespec __user *u_ts)); +COBALT_SYSCALL_DECL (clock_settime, (clockid_t clock_id, const struct __user_old_timespec __user *u_ts));
kernel/cobalt/posix/syscall32.c +7 -0
@@ -170,6 +170,13 @@ COBALT_SYSCALL32emu(clock_gettime, current,return sys32_put_timespec (u_ts, &ts); } +COBALT_SYSCALL32emu (clock_gettime64, current, + (clockid_t clock_id, + struct __kernel_timespec __user *u_ts)) +{ +return __cobalt_clock_gettime64 (clock_id, u_ts); +} +COBALT_SYSCALL32emu (clock_settime, current, (clockid_t clock_id, const struct old_timespec32 __user *u_ts))
kernel/cobalt/posix/syscall32.h +4 -0
@@ -59,6 +59,10 @@ COBALT_SYSCALL32emu_DECL(clock_gettime, (clockid_t clock_id, struct old_timespec32 __user *u_ts)); +COBALT_SYSCALL32emu_DECL (clock_gettime64, + (clockid_t clock_id, + struct __kernel_timespec __user *u_ts)); +COBALT_SYSCALL32emu_DECL (clock_settime, (clockid_t clock_id, const struct old_timespec32 __user *u_ts));
kernel/cobalt/time.c +11 -0
@@ -25,3 +25,14 @@ int cobalt_get_timespec64(struct timespec64 *ts,return 0 ; } + +int cobalt_put_timespec64 (const struct timespec64 *ts, +struct __kernel_timespec __user *uts) +{ +struct __kernel_timespec kts = { + .tv_sec = ts->tv_sec, + .tv_nsec = ts->tv_nsec + }; + +return cobalt_copy_to_user (uts, &kts,sizeof (kts)) ? -EFAULT :0 ; +}
Signature · 1 line
2.31.1
PATCH 3/9 y2038: cobalt/posix/clock: Adding clock_settime64
In reply to Florian BezdekaFrom: chensong <[email protected]>
Adding a new syscall clock_settime64 which is y2038 safe
--- include/cobalt/uapi/syscall.h | 1 + kernel/cobalt/posix/clock.c | 17 +++++++++++++++++ kernel/cobalt/posix/clock.h | 7 +++++++ kernel/cobalt/posix/syscall32.c | 7 +++++++ kernel/cobalt/posix/syscall32.h | 4 ++++ 5 files changed, 36 insertions(+)
include/cobalt/uapi/syscall.h +1 -0
@@ -124,6 +124,7 @@#define sc_cobalt_thread_setschedprio 101#define sc_cobalt_sem_timedwait64 102#define sc_cobalt_clock_gettime64 103 +#define sc_cobalt_clock_settime64 104#define __NR_COBALT_SYSCALLS 128/* Power of 2 */
kernel/cobalt/posix/clock.c +17 -0
@@ -219,6 +219,23 @@ COBALT_SYSCALL(clock_settime, current,return __cobalt_clock_settime (clock_id, &ts); } +int __cobalt_clock_settime64 (clockid_t clock_id, +const struct __kernel_timespec __user *u_ts) +{ +struct timespec64 ts64; + +if (cobalt_get_timespec64 (&ts64, u_ts)) +return -EFAULT ; + +return __cobalt_clock_settime (clock_id, &ts64); +} + +COBALT_SYSCALL (clock_settime64, current, + (clockid_t clock_id, const struct __kernel_timespec __user *u_ts)) +{ +return __cobalt_clock_settime64 (clock_id, u_ts); +} +COBALT_SYSCALL (clock_adjtime, current, (clockid_t clock_id, struct __user_old_timex __user *u_tx)) {
kernel/cobalt/posix/clock.h +7 -0
@@ -106,6 +106,9 @@ int __cobalt_clock_gettime64(clockid_t clock_id,int __cobalt_clock_settime (clockid_t clock_id,const struct timespec64 *ts); +int __cobalt_clock_settime64 (clockid_t clock_id, +const struct __kernel_timespec __user *u_ts); +int __cobalt_clock_adjtime (clockid_t clock_id,struct __kernel_timex *tx);
@@ -125,6 +128,10 @@ COBALT_SYSCALL_DECL(clock_gettime64,COBALT_SYSCALL_DECL (clock_settime, (clockid_t clock_id, const struct __user_old_timespec __user *u_ts)); +COBALT_SYSCALL_DECL (clock_settime64, + (clockid_t clock_id, + const struct __kernel_timespec __user *u_ts)); +COBALT_SYSCALL_DECL (clock_adjtime, (clockid_t clock_id, struct __user_old_timex __user *u_tx));
kernel/cobalt/posix/syscall32.c +7 -0
@@ -191,6 +191,13 @@ COBALT_SYSCALL32emu(clock_settime, current,return __cobalt_clock_settime (clock_id, &ts); } +COBALT_SYSCALL32emu (clock_settime64, current, + (clockid_t clock_id, + const struct __kernel_timespec __user *u_ts)) +{ +return __cobalt_clock_settime64 (clock_id, u_ts); +} +COBALT_SYSCALL32emu (clock_adjtime, current, (clockid_t clock_id, struct old_timex32 __user *u_tx)) {
kernel/cobalt/posix/syscall32.h +4 -0
@@ -67,6 +67,10 @@ COBALT_SYSCALL32emu_DECL(clock_settime, (clockid_t clock_id, const struct old_timespec32 __user *u_ts)); +COBALT_SYSCALL32emu_DECL (clock_settime64, + (clockid_t clock_id, + const struct __kernel_timespec __user *u_ts)); +COBALT_SYSCALL32emu_DECL (clock_adjtime, (clockid_t clock_id, struct old_timex32 __user *u_tx));
Signature · 1 line
2.31.1
PATCH 4/9 y2038: lib/cobalt/clock: dispatch clock_gettime
In reply to Florian BezdekaFrom: chensong <[email protected]>
If sizeof time_t bigger than 4, which means glibc supports 64bit timespec, go to clock_gettime64.
otherwise, go to original clock_settime.
--- lib/cobalt/clock.c | 4 ++++ 1 file changed, 4 insertions(+)
lib/cobalt/clock.c +4 -0
@@ -151,7 +151,11 @@ static int __do_clock_host_realtime(struct timespec *ts)static int __do_clock_gettime (clockid_t clock_id,struct timespec *tp) { +#ifdef __USE_TIME_BITS64 +return -XENOMAI_SYSCALL2 (sc_cobalt_clock_gettime64, clock_id, tp); +#else return -XENOMAI_SYSCALL2 (sc_cobalt_clock_gettime, clock_id, tp); +#endif }static int gettime_via_tsc (clockid_t clock_id,struct timespec *tp)
Signature · 1 line
2.31.1
PATCH 5/9 y2038: lib/cobalt/clock: dispatch clock_settime
In reply to Florian BezdekaFrom: chensong <[email protected]>
If sizeof time_t bigger than 4, which means glibc supports 64bit timespec, go to clock_settime64.
otherwise, go to original clock_settime.
--- lib/cobalt/clock.c | 4 ++++ 1 file changed, 4 insertions(+)
lib/cobalt/clock.c +4 -0
@@ -285,7 +285,11 @@ 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 (sc_cobalt_clock_settime64, clock_id, tp); +#else ret = -XENOMAI_SYSCALL2 (sc_cobalt_clock_settime, clock_id, tp); +#endif if (ret) { errno = ret;return -1 ;
Signature · 1 line
2.31.1
PATCH 6/9 y2038: testsuite/smokey/y2038: testcase for settime64 and gettime64
In reply to Florian BezdekaFrom: chensong <[email protected]>
Adding new test cases for clock_settime64 and clock_gettime64.
--- testsuite/smokey/y2038/syscall-tests.c | 84 ++++++++++++++++++++++++++ 1 file changed, 84 insertions(+)
testsuite/smokey/y2038/syscall-tests.c +84 -0
@@ -166,6 +166,82 @@ static int test_sc_cobalt_sem_timedwait64(void)return 0 ; } +static int test_sc_cobalt_clock_gettime64 (void ) +{ +int ret; +int sc_nr = sc_cobalt_clock_gettime64; +struct xn_timespec64 ts64 = {0 }; + +/* Make sure we don't crash because of NULL pointers */ + ret =XENOMAI_SYSCALL2 (sc_nr,NULL ,NULL ); +if (ret == -ENOSYS ) { +smokey_note ("clock_gettime64: skipped. (no kernel support)" ); +return 0 ;// Not implemented, nothing to test, success + } +if (!smokey_assert (ret == -EFAULT )) +return ret ? ret : -EINVAL ; + +/* Providing an invalid address has to deliver EFAULT */ + ret =XENOMAI_SYSCALL2 (sc_nr,CLOCK_MONOTONIC , (void *)0xdeadbeefUL ); +if (!smokey_assert (ret == -EFAULT )) +return ret ? ret : -EINVAL ; + +/* Provide a valid 64bit timespec */ + ret =XENOMAI_SYSCALL2 (sc_nr,CLOCK_MONOTONIC , &ts64); +if (!smokey_assert (!ret)) +return ret ? ret : -EINVAL ; + +/* Validate seconds only, nanoseconds might still be zero */ +smokey_assert (ts64.tv_sec !=0 ); + +return 0 ; +} + +static int test_sc_cobalt_clock_settime64 (void ) +{ +int ret; +int sc_nr = sc_cobalt_clock_settime64; +struct xn_timespec64 ts64, now64; +struct timespec now; + +/* Make sure we don't crash because of NULL pointers */ + ret =XENOMAI_SYSCALL2 (sc_nr,NULL ,NULL ); +if (ret == -ENOSYS ) { +smokey_note ("clock_settime64: skipped. (no kernel support)" ); +return 0 ;// Not implemented, nothing to test, success + } +if (!smokey_assert (ret == -EFAULT )) +return ret ? ret : -EINVAL ; + +/* Providing an invalid address has to deliver EFAULT */ + ret =XENOMAI_SYSCALL2 (sc_nr,CLOCK_MONOTONIC , (void *)0xdeadbeefUL ); +if (!smokey_assert (ret == -EFAULT )) +return ret ? ret : -EINVAL ; + + ret =clock_gettime (CLOCK_REALTIME , &now); +if (ret) +return -errno; + +/* Provide a valid 64bit timespec */ + ts64.tv_sec = now.tv_sec +1 ; + ts64.tv_nsec = now.tv_nsec; + ret =XENOMAI_SYSCALL2 (sc_nr,CLOCK_REALTIME , &ts64); +if (!smokey_assert (!ret)) +return ret ? ret : -EINVAL ; + + ret =clock_gettime (CLOCK_REALTIME , &now); +if (ret) +return -errno; + + now64.tv_sec = now.tv_sec; + now64.tv_nsec = now.tv_nsec; + +if (ts_less (&now64, &ts64)) +smokey_warning ("clock_settime() reported no error but no new time seen" ); + +return 0 ; +} +static int run_y2038 (struct smokey_test *t,int argc,char *const argv[]) {int ret;
@@ -174,5 +250,13 @@ static int run_y2038(struct smokey_test *t, int argc, char *const argv[])if (ret)return ret; + ret =test_sc_cobalt_clock_gettime64 (); +if (ret) +return ret; + + ret =test_sc_cobalt_clock_settime64 (); +if (ret) +return ret; +return 0 ; }
Signature · 1 line
2.31.1
PATCH 7/9 y2038: cobalt/posix/clock: Adding clock_nanosleep64
In reply to Florian BezdekaFrom: chensong <[email protected]>
Add a syscall specific for clock_nanosleep with 64bit time_t.
--- include/cobalt/uapi/syscall.h | 1 + kernel/cobalt/posix/clock.c | 30 ++++++++++++++++++++++++++++++ kernel/cobalt/posix/clock.h | 9 +++++++++ kernel/cobalt/posix/syscall32.c | 9 +++++++++ kernel/cobalt/posix/syscall32.h | 6 ++++++ 5 files changed, 55 insertions(+)
include/cobalt/uapi/syscall.h +1 -0
@@ -125,6 +125,7 @@#define sc_cobalt_sem_timedwait64 102#define sc_cobalt_clock_gettime64 103#define sc_cobalt_clock_settime64 104 +#define sc_cobalt_clock_nanosleep64 105#define __NR_COBALT_SYSCALLS 128/* Power of 2 */
kernel/cobalt/posix/clock.c +30 -0
@@ -355,6 +355,36 @@ COBALT_SYSCALL(clock_nanosleep, primary,return ret; } +int __cobalt_clock_nanosleep64 (clockid_t clock_id,int flags, +const struct __kernel_timespec __user *u_rqt, +struct __kernel_timespec __user *u_rmt) +{ +struct timespec64 rqt, rmt, *rmtp =NULL ; +int ret; + +if (u_rmt) + rmtp = &rmt; + +if (cobalt_get_timespec64 (&rqt, u_rqt)) +return -EFAULT ; + + ret =__cobalt_clock_nanosleep (clock_id, flags, &rqt, rmtp); +if (ret == -EINTR && flags ==0 && rmtp) { +if (cobalt_put_timespec64 (rmtp, u_rmt)) +return -EFAULT ; + } + +return ret; +} + +COBALT_SYSCALL (clock_nanosleep64, primary, + (clockid_t clock_id, int flags, + const struct __kernel_timespec __user *u_rqt, + struct __kernel_timespec __user *u_rmt)) +{ +return __cobalt_clock_nanosleep64 (clock_id, flags, u_rqt, u_rmt); +} +int cobalt_clock_register (struct xnclock *clock,const cpumask_t *affinity,clockid_t *clk_id) {
kernel/cobalt/posix/clock.h +9 -0
@@ -116,6 +116,10 @@ int __cobalt_clock_nanosleep(clockid_t clock_id, int flags,const struct timespec64 *rqt, struct timespec64 *rmt); +int __cobalt_clock_nanosleep64 (clockid_t clock_id,int flags, +const struct __kernel_timespec __user *u_rqt, +struct __kernel_timespec __user *u_rmt); +COBALT_SYSCALL_DECL (clock_getres, (clockid_t clock_id, struct __user_old_timespec __user *u_ts));
@@ -140,6 +144,11 @@ COBALT_SYSCALL_DECL(clock_nanosleep,const struct __user_old_timespec __user *u_rqt, struct __user_old_timespec __user *u_rmt)); +COBALT_SYSCALL_DECL (clock_nanosleep64, + (clockid_t clock_id, int flags, + const struct __kernel_timespec __user *u_rqt, + struct __kernel_timespec __user *u_rmt)); +int cobalt_clock_register (struct xnclock *clock,const cpumask_t *affinity,clockid_t *clk_id);
kernel/cobalt/posix/syscall32.c +9 -0
@@ -237,6 +237,15 @@ COBALT_SYSCALL32emu(clock_nanosleep, nonrestartable,return ret; } +COBALT_SYSCALL32emu (clock_nanosleep64, nonrestartable, + (clockid_t clock_id, int flags, + const struct __kernel_timespec __user *u_rqt, + struct __kernel_timespec __user *u_rmt)) +{ +return __cobalt_clock_nanosleep64 (clock_id, flags, u_rqt, u_rmt); +} + +COBALT_SYSCALL32emu (mutex_timedlock, primary, (struct cobalt_mutex_shadow __user *u_mx, const struct old_timespec32 __user *u_ts))
kernel/cobalt/posix/syscall32.h +6 -0
@@ -80,6 +80,12 @@ COBALT_SYSCALL32emu_DECL(clock_nanosleep,const struct old_timespec32 __user *u_rqt, struct old_timespec32 __user *u_rmt)); +COBALT_SYSCALL32emu_DECL (clock_nanosleep64, + (clockid_t clock_id, int flags, + const struct __kernel_timespec __user *u_rqt, + struct __kernel_timespec __user *u_rmt)); + +COBALT_SYSCALL32emu_DECL (mutex_timedlock, (struct cobalt_mutex_shadow __user *u_mx, const struct old_timespec32 __user *u_ts));
Signature · 1 line
2.31.1
PATCH 8/9 y2038: lib/cobalt/clock: dispatch clock_nanosleep
In reply to Florian BezdekaFrom: chensong <[email protected]>
If sizeof time_t bigger than 4, which means glibc supports 64bit timespec, go to clock_nanosleep64.
otherwise, go to original clock_nanosleep.
--- lib/cobalt/clock.c | 5 +++++ 1 file changed, 5 insertions(+)
lib/cobalt/clock.c +5 -0
@@ -361,8 +361,13 @@ COBALT_IMPL(int, clock_nanosleep, (clockid_t clock_id,pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS , &oldtype); +#ifdef __USE_TIME_BITS64 + ret = -XENOMAI_SYSCALL4 (sc_cobalt_clock_nanosleep64, + clock_id, flags, rqtp, rmtp); +#else ret = -XENOMAI_SYSCALL4 (sc_cobalt_clock_nanosleep, clock_id, flags, rqtp, rmtp); +#endif pthread_setcanceltype (oldtype,NULL );
Signature · 1 line
2.31.1
PATCH 9/9 y2038: testsuite/smokey/y2038: Adding testcase for nanosleep64
In reply to Florian BezdekaFrom: chensong <[email protected]>
Add test case for clock_nanosleep64 in smokey testsuite
--- testsuite/smokey/y2038/syscall-tests.c | 67 ++++++++++++++++++++++++++ 1 file changed, 67 insertions(+)
testsuite/smokey/y2038/syscall-tests.c +67 -0
@@ -242,6 +242,69 @@ static int test_sc_cobalt_clock_settime64(void)return 0 ; } +static int test_sc_cobalt_clock_nanosleep64 (void ) +{ +int ret; +int sc_nr = sc_cobalt_clock_nanosleep64; +struct xn_timespec64 next, rmt; +struct timespec ts1, ts2, delta; +long interval =1 ; + +/* Make sure we don't crash because of NULL pointers */ + ret =XENOMAI_SYSCALL4 (sc_nr,NULL ,NULL ,NULL ,NULL ); +if (ret == -ENOSYS ) { +smokey_note ("clock_nanosleep64: skipped. (no kernel support)" ); +return 0 ;// Not implemented, nothing to test, success + } +if (!smokey_assert (ret == -EFAULT )) +return ret ? ret : -EINVAL ; + +/* Providing an invalid address has to deliver EFAULT */ + ret =XENOMAI_SYSCALL4 (sc_nr,CLOCK_MONOTONIC ,TIMER_ABSTIME , + (void *)0xdeadbeefUL , &rmt); +if (!smokey_assert (ret == -EFAULT )) +return ret ? ret : -EINVAL ; + +/* Provide a valid 64bit timespec, round 1 */ + ret =clock_gettime (CLOCK_MONOTONIC , &ts1); +if (ret) +return -errno; + + next.tv_sec = ts1.tv_sec + interval; + next.tv_nsec = ts1.tv_nsec; + + ret =XENOMAI_SYSCALL4 (sc_nr,CLOCK_MONOTONIC ,TIMER_ABSTIME , + &next, (void *)0xdeadbeefUL ); +if (!smokey_assert (!ret)) +return ret ? ret : -EINVAL ; + + ret =clock_gettime (CLOCK_MONOTONIC , &ts2); +if (ret) +return -errno; + +timespec_sub (&delta, &ts2, &ts1); +if (delta.tv_sec < interval) +smokey_warning ("nanosleep didn't sleep long enough." ); + +/* Provide a valid 64bit timespec, round 2*/ + next.tv_sec = ts2.tv_sec + interval; + next.tv_nsec = ts2.tv_nsec; + + ret =XENOMAI_SYSCALL4 (sc_nr,CLOCK_MONOTONIC ,TIMER_ABSTIME , &next, &rmt); +if (!smokey_assert (!ret)) +return ret ? ret : -EINVAL ; + + ret =clock_gettime (CLOCK_MONOTONIC , &ts1); +if (ret) +return -errno; + +timespec_sub (&delta, &ts1, &ts2); +if (delta.tv_sec < interval) +smokey_warning ("nanosleep didn't sleep long enough." ); + +return 0 ; +} +static int run_y2038 (struct smokey_test *t,int argc,char *const argv[]) {int ret;
@@ -258,5 +321,9 @@ static int run_y2038(struct smokey_test *t, int argc, char *const argv[])if (ret)return ret; + ret =test_sc_cobalt_clock_nanosleep64 (); +if (ret) +return ret; +return 0 ; }
Signature · 1 line
2.31.1
Re: [PATCH 9/9] y2038: testsuite/smokey/y2038: Adding testcase for nanosleep64
Quoted 44 lines · Florian Bezdeka
From: chensong <[email protected]>
Add test case for
clock_nanosleep64in smokey testsuiteSigned-off-by chensong <[email protected]>[Florian: Reword commit msg, syscall()->XENOMAI_SYSCALLx()]Signed-off-by Florian Bezdeka <[email protected]>--- testsuite/smokey/y2038/syscall-tests.c | 67 ++++++++++++++++++++++++++ 1 file changed, 67 insertions(+)testsuite/smokey/y2038/syscall-tests.c +25
-0@@ -242,6 +242,69 @@ static int test_sc_cobalt_clock_settime64(void)return 0 ; } +static int test_sc_cobalt_clock_nanosleep64 (void ) +{ +int ret; +int sc_nr = sc_cobalt_clock_nanosleep64; +struct xn_timespec64 next, rmt; +struct timespec ts1, ts2, delta; +long interval =1 ; + +/* Make sure we don't crash because of NULL pointers */ + ret =XENOMAI_SYSCALL4 (sc_nr,NULL ,NULL ,NULL ,NULL ); +if (ret == -ENOSYS ) { +smokey_note ("clock_nanosleep64: skipped. (no kernel support)" ); +return 0 ;// Not implemented, nothing to test, success + } +if (!smokey_assert (ret == -EFAULT )) +return ret ? ret : -EINVAL ; + +/* Providing an invalid address has to deliver EFAULT */ + ret =XENOMAI_SYSCALL4 (sc_nr,CLOCK_MONOTONIC ,TIMER_ABSTIME , + (void *)0xdeadbeefUL , &rmt); +if (!smokey_assert (ret == -EFAULT )) +return ret ? ret : -EINVAL ; + +/* Provide a valid 64bit timespec, round 1 */ + ret =clock_gettime (CLOCK_MONOTONIC , &ts1);
testsuite/smokey/y2038/syscall-tests.c static int test_sc_cobalt_clock_settime64(void) · line 279
Quoted 10 lines
testsuite/smokey/y2038/syscall-tests.c +10
-0+if (ret) +return -errno; + + next.tv_sec = ts1.tv_sec + interval; + next.tv_nsec = ts1.tv_nsec; + + ret =XENOMAI_SYSCALL4 (sc_nr,CLOCK_MONOTONIC ,TIMER_ABSTIME , + &next, (void *)0xdeadbeefUL ); +if (!smokey_assert (!ret)) +return ret ? ret : -EINVAL ;
Unneeded test here - ret is != 0.
Quoted 6 lines
testsuite/smokey/y2038/syscall-tests.c +6
-0+ + ret =clock_gettime (CLOCK_MONOTONIC , &ts2); +if (ret) +return -errno; + +timespec_sub (&delta, &ts2, &ts1);
testsuite/smokey/y2038/syscall-tests.c static int test_sc_cobalt_clock_settime64(void) · line 295
Quoted 10 lines
testsuite/smokey/y2038/syscall-tests.c +10
-0+if (delta.tv_sec < interval) +smokey_warning ("nanosleep didn't sleep long enough." ); + +/* Provide a valid 64bit timespec, round 2*/ + next.tv_sec = ts2.tv_sec + interval; + next.tv_nsec = ts2.tv_nsec; + + ret =XENOMAI_SYSCALL4 (sc_nr,CLOCK_MONOTONIC ,TIMER_ABSTIME , &next, &rmt); +if (!smokey_assert (!ret)) +return ret ? ret : -EINVAL ;
Same here.
I can fix those up - once I understood why they trigger here ATM.
Jan
Quoted 26 lines
testsuite/smokey/y2038/syscall-tests.c +16
-0+ + ret =clock_gettime (CLOCK_MONOTONIC , &ts1); +if (ret) +return -errno; + +timespec_sub (&delta, &ts1, &ts2); +if (delta.tv_sec < interval) +smokey_warning ("nanosleep didn't sleep long enough." ); + +return 0 ; +} +static int run_y2038 (struct smokey_test *t,int argc,char *const argv[]) {int ret;@@ -258,5 +321,9 @@ static int run_y2038(struct smokey_test *t, int argc, char *const argv[])if (ret)return ret; + ret =test_sc_cobalt_clock_nanosleep64 (); +if (ret) +return ret; +return 0 ; }
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux
Re: [PATCH 9/9] y2038: testsuite/smokey/y2038: Adding testcase for nanosleep64
Quoted 77 lines · Jan Kiszka via Xenomai
Quoted 44 lines · Florian Bezdeka
From: chensong <[email protected]>
Add test case for
clock_nanosleep64in smokey testsuiteSigned-off-by chensong <[email protected]>[Florian: Reword commit msg, syscall()->XENOMAI_SYSCALLx()]Signed-off-by Florian Bezdeka <[email protected]>--- testsuite/smokey/y2038/syscall-tests.c | 67 ++++++++++++++++++++++++++ 1 file changed, 67 insertions(+)testsuite/smokey/y2038/syscall-tests.c +25
-0@@ -242,6 +242,69 @@ static int test_sc_cobalt_clock_settime64(void)return 0 ; } +static int test_sc_cobalt_clock_nanosleep64 (void ) +{ +int ret; +int sc_nr = sc_cobalt_clock_nanosleep64; +struct xn_timespec64 next, rmt; +struct timespec ts1, ts2, delta; +long interval =1 ; + +/* Make sure we don't crash because of NULL pointers */ + ret =XENOMAI_SYSCALL4 (sc_nr,NULL ,NULL ,NULL ,NULL ); +if (ret == -ENOSYS ) { +smokey_note ("clock_nanosleep64: skipped. (no kernel support)" ); +return 0 ;// Not implemented, nothing to test, success + } +if (!smokey_assert (ret == -EFAULT )) +return ret ? ret : -EINVAL ; + +/* Providing an invalid address has to deliver EFAULT */ + ret =XENOMAI_SYSCALL4 (sc_nr,CLOCK_MONOTONIC ,TIMER_ABSTIME , + (void *)0xdeadbeefUL , &rmt); +if (!smokey_assert (ret == -EFAULT )) +return ret ? ret : -EINVAL ; + +/* Provide a valid 64bit timespec, round 1 */ + ret =clock_gettime (CLOCK_MONOTONIC , &ts1);testsuite/smokey/y2038/syscall-tests.c static int test_sc_cobalt_clock_settime64(void) · line 279
Quoted 10 lines
testsuite/smokey/y2038/syscall-tests.c +10
-0+if (ret) +return -errno; + + next.tv_sec = ts1.tv_sec + interval; + next.tv_nsec = ts1.tv_nsec; + + ret =XENOMAI_SYSCALL4 (sc_nr,CLOCK_MONOTONIC ,TIMER_ABSTIME , + &next, (void *)0xdeadbeefUL ); +if (!smokey_assert (!ret)) +return ret ? ret : -EINVAL ;Unneeded test here - ret is != 0.
Quoted 6 lines
testsuite/smokey/y2038/syscall-tests.c +6
-0+ + ret =clock_gettime (CLOCK_MONOTONIC , &ts2); +if (ret) +return -errno; + +timespec_sub (&delta, &ts2, &ts1);testsuite/smokey/y2038/syscall-tests.c static int test_sc_cobalt_clock_settime64(void) · line 295
Quoted 10 lines
testsuite/smokey/y2038/syscall-tests.c +10
-0+if (delta.tv_sec < interval) +smokey_warning ("nanosleep didn't sleep long enough." ); + +/* Provide a valid 64bit timespec, round 2*/ + next.tv_sec = ts2.tv_sec + interval; + next.tv_nsec = ts2.tv_nsec; + + ret =XENOMAI_SYSCALL4 (sc_nr,CLOCK_MONOTONIC ,TIMER_ABSTIME , &next, &rmt); +if (!smokey_assert (!ret)) +return ret ? ret : -EINVAL ;Same here.
Quoted 2 lines
I can fix those up - once I understood why they trigger here ATM.
In fact, if we want to return the real error, errno needs to be consulted. What is the intention then?
Jan
Quoted 28 lines
Quoted 26 lines
testsuite/smokey/y2038/syscall-tests.c +16
-0+ + ret =clock_gettime (CLOCK_MONOTONIC , &ts1); +if (ret) +return -errno; + +timespec_sub (&delta, &ts1, &ts2); +if (delta.tv_sec < interval) +smokey_warning ("nanosleep didn't sleep long enough." ); + +return 0 ; +} +static int run_y2038 (struct smokey_test *t,int argc,char *const argv[]) {int ret;@@ -258,5 +321,9 @@ static int run_y2038(struct smokey_test *t, int argc, char *const argv[])if (ret)return ret; + ret =test_sc_cobalt_clock_nanosleep64 (); +if (ret) +return ret; +return 0 ; }
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux
Re: [PATCH 9/9] y2038: testsuite/smokey/y2038: Adding testcase for nanosleep64
Quoted 78 lines · Jan Kiszka via Xenomai
Quoted 77 lines · Jan Kiszka via Xenomai
Quoted 44 lines · Florian Bezdeka
From: chensong <[email protected]>
Add test case for
clock_nanosleep64in smokey testsuiteSigned-off-by chensong <[email protected]>[Florian: Reword commit msg, syscall()->XENOMAI_SYSCALLx()]Signed-off-by Florian Bezdeka <[email protected]>--- testsuite/smokey/y2038/syscall-tests.c | 67 ++++++++++++++++++++++++++ 1 file changed, 67 insertions(+)testsuite/smokey/y2038/syscall-tests.c +25
-0@@ -242,6 +242,69 @@ static int test_sc_cobalt_clock_settime64(void)return 0 ; } +static int test_sc_cobalt_clock_nanosleep64 (void ) +{ +int ret; +int sc_nr = sc_cobalt_clock_nanosleep64; +struct xn_timespec64 next, rmt; +struct timespec ts1, ts2, delta; +long interval =1 ; + +/* Make sure we don't crash because of NULL pointers */ + ret =XENOMAI_SYSCALL4 (sc_nr,NULL ,NULL ,NULL ,NULL ); +if (ret == -ENOSYS ) { +smokey_note ("clock_nanosleep64: skipped. (no kernel support)" ); +return 0 ;// Not implemented, nothing to test, success + } +if (!smokey_assert (ret == -EFAULT )) +return ret ? ret : -EINVAL ; + +/* Providing an invalid address has to deliver EFAULT */ + ret =XENOMAI_SYSCALL4 (sc_nr,CLOCK_MONOTONIC ,TIMER_ABSTIME , + (void *)0xdeadbeefUL , &rmt); +if (!smokey_assert (ret == -EFAULT )) +return ret ? ret : -EINVAL ; + +/* Provide a valid 64bit timespec, round 1 */ + ret =clock_gettime (CLOCK_MONOTONIC , &ts1);testsuite/smokey/y2038/syscall-tests.c static int test_sc_cobalt_clock_settime64(void) · line 279
Quoted 10 lines
testsuite/smokey/y2038/syscall-tests.c +10
-0+if (ret) +return -errno; + + next.tv_sec = ts1.tv_sec + interval; + next.tv_nsec = ts1.tv_nsec; + + ret =XENOMAI_SYSCALL4 (sc_nr,CLOCK_MONOTONIC ,TIMER_ABSTIME , + &next, (void *)0xdeadbeefUL ); +if (!smokey_assert (!ret)) +return ret ? ret : -EINVAL ;Unneeded test here - ret is != 0.
Quoted 6 lines
testsuite/smokey/y2038/syscall-tests.c +6
-0+ + ret =clock_gettime (CLOCK_MONOTONIC , &ts2); +if (ret) +return -errno; + +timespec_sub (&delta, &ts2, &ts1);testsuite/smokey/y2038/syscall-tests.c static int test_sc_cobalt_clock_settime64(void) · line 295
Quoted 10 lines
testsuite/smokey/y2038/syscall-tests.c +10
-0+if (delta.tv_sec < interval) +smokey_warning ("nanosleep didn't sleep long enough." ); + +/* Provide a valid 64bit timespec, round 2*/ + next.tv_sec = ts2.tv_sec + interval; + next.tv_nsec = ts2.tv_nsec; + + ret =XENOMAI_SYSCALL4 (sc_nr,CLOCK_MONOTONIC ,TIMER_ABSTIME , &next, &rmt); +if (!smokey_assert (!ret)) +return ret ? ret : -EINVAL ;Same here.
Quoted 5 lines
Quoted 2 lines
I can fix those up - once I understood why they trigger here ATM.
In fact, if we want to return the real error, errno needs to be consulted. What is the intention then?
Err, no, it's direct syscall invocation, no errno at this point yet.
Found the reason for the failing test meanwhile: I was on wip/dovetail already, and there we have
static inline int pipeline_set_wallclock(xnticks_t epoch_ns)
{
return -EOPNOTSUPP;
}Philippe, any particular reason for this?
Jan
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux
Re: [PATCH 9/9] y2038: testsuite/smokey/y2038: Adding testcase for nanosleep64
Quoted 90 lines · Jan Kiszka
Quoted 78 lines · Jan Kiszka via Xenomai
Quoted 77 lines · Jan Kiszka via Xenomai
Quoted 44 lines · Florian Bezdeka
From: chensong <[email protected]>
Add test case for
clock_nanosleep64in smokey testsuiteSigned-off-by chensong <[email protected]>[Florian: Reword commit msg, syscall()->XENOMAI_SYSCALLx()]Signed-off-by Florian Bezdeka <[email protected]>--- testsuite/smokey/y2038/syscall-tests.c | 67 ++++++++++++++++++++++++++ 1 file changed, 67 insertions(+)testsuite/smokey/y2038/syscall-tests.c +25
-0@@ -242,6 +242,69 @@ static int test_sc_cobalt_clock_settime64(void)return 0 ; } +static int test_sc_cobalt_clock_nanosleep64 (void ) +{ +int ret; +int sc_nr = sc_cobalt_clock_nanosleep64; +struct xn_timespec64 next, rmt; +struct timespec ts1, ts2, delta; +long interval =1 ; + +/* Make sure we don't crash because of NULL pointers */ + ret =XENOMAI_SYSCALL4 (sc_nr,NULL ,NULL ,NULL ,NULL ); +if (ret == -ENOSYS ) { +smokey_note ("clock_nanosleep64: skipped. (no kernel support)" ); +return 0 ;// Not implemented, nothing to test, success + } +if (!smokey_assert (ret == -EFAULT )) +return ret ? ret : -EINVAL ; + +/* Providing an invalid address has to deliver EFAULT */ + ret =XENOMAI_SYSCALL4 (sc_nr,CLOCK_MONOTONIC ,TIMER_ABSTIME , + (void *)0xdeadbeefUL , &rmt); +if (!smokey_assert (ret == -EFAULT )) +return ret ? ret : -EINVAL ; + +/* Provide a valid 64bit timespec, round 1 */ + ret =clock_gettime (CLOCK_MONOTONIC , &ts1);testsuite/smokey/y2038/syscall-tests.c static int test_sc_cobalt_clock_settime64(void) · line 279
Quoted 10 lines
testsuite/smokey/y2038/syscall-tests.c +10
-0+if (ret) +return -errno; + + next.tv_sec = ts1.tv_sec + interval; + next.tv_nsec = ts1.tv_nsec; + + ret =XENOMAI_SYSCALL4 (sc_nr,CLOCK_MONOTONIC ,TIMER_ABSTIME , + &next, (void *)0xdeadbeefUL ); +if (!smokey_assert (!ret)) +return ret ? ret : -EINVAL ;Unneeded test here - ret is != 0.
Quoted 6 lines
testsuite/smokey/y2038/syscall-tests.c +6
-0+ + ret =clock_gettime (CLOCK_MONOTONIC , &ts2); +if (ret) +return -errno; + +timespec_sub (&delta, &ts2, &ts1);testsuite/smokey/y2038/syscall-tests.c static int test_sc_cobalt_clock_settime64(void) · line 295
Quoted 10 lines
testsuite/smokey/y2038/syscall-tests.c +10
-0+if (delta.tv_sec < interval) +smokey_warning ("nanosleep didn't sleep long enough." ); + +/* Provide a valid 64bit timespec, round 2*/ + next.tv_sec = ts2.tv_sec + interval; + next.tv_nsec = ts2.tv_nsec; + + ret =XENOMAI_SYSCALL4 (sc_nr,CLOCK_MONOTONIC ,TIMER_ABSTIME , &next, &rmt); +if (!smokey_assert (!ret)) +return ret ? ret : -EINVAL ;Same here.
Quoted 5 lines
Quoted 2 lines
I can fix those up - once I understood why they trigger here ATM.
In fact, if we want to return the real error, errno needs to be consulted. What is the intention then?
Err, no, it's direct syscall invocation, no errno at this point yet.
Found the reason for the failing test meanwhile: I was on wip/dovetail already, and there we have
Quoted 7 lines
static inline int
pipeline_set_wallclock(xnticks_t epoch_ns){ return -EOPNOTSUPP; }Philippe, any particular reason for this?
...because of
COBALT_IMPL(int, clock_settime, (clockid_t clock_id, const struct timespec *tp))
{
int ret;
if (clock_id == CLOCK_REALTIME && !cobalt_use_legacy_tsc())
return __STD(clock_settime(CLOCK_REALTIME, tp));IOW, that set settime64 syscall is I-pipe only.
Florian, we need to adjust the test case accordingly for dovetail.
Jan
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux
Re: [PATCH 9/9] y2038: testsuite/smokey/y2038: Adding testcase for nanosleep64
In reply to Jan KiszkaQuoted 90 lines · Jan Kiszka
Quoted 78 lines · Jan Kiszka via Xenomai
Quoted 77 lines · Jan Kiszka via Xenomai
Quoted 44 lines · Florian Bezdeka
From: chensong <[email protected]>
Add test case for
clock_nanosleep64in smokey testsuiteSigned-off-by chensong <[email protected]>[Florian: Reword commit msg, syscall()->XENOMAI_SYSCALLx()]Signed-off-by Florian Bezdeka <[email protected]>--- testsuite/smokey/y2038/syscall-tests.c | 67 ++++++++++++++++++++++++++ 1 file changed, 67 insertions(+)testsuite/smokey/y2038/syscall-tests.c +25
-0@@ -242,6 +242,69 @@ static int test_sc_cobalt_clock_settime64(void)return 0 ; } +static int test_sc_cobalt_clock_nanosleep64 (void ) +{ +int ret; +int sc_nr = sc_cobalt_clock_nanosleep64; +struct xn_timespec64 next, rmt; +struct timespec ts1, ts2, delta; +long interval =1 ; + +/* Make sure we don't crash because of NULL pointers */ + ret =XENOMAI_SYSCALL4 (sc_nr,NULL ,NULL ,NULL ,NULL ); +if (ret == -ENOSYS ) { +smokey_note ("clock_nanosleep64: skipped. (no kernel support)" ); +return 0 ;// Not implemented, nothing to test, success + } +if (!smokey_assert (ret == -EFAULT )) +return ret ? ret : -EINVAL ; + +/* Providing an invalid address has to deliver EFAULT */ + ret =XENOMAI_SYSCALL4 (sc_nr,CLOCK_MONOTONIC ,TIMER_ABSTIME , + (void *)0xdeadbeefUL , &rmt); +if (!smokey_assert (ret == -EFAULT )) +return ret ? ret : -EINVAL ; + +/* Provide a valid 64bit timespec, round 1 */ + ret =clock_gettime (CLOCK_MONOTONIC , &ts1);testsuite/smokey/y2038/syscall-tests.c static int test_sc_cobalt_clock_settime64(void) · line 279
Quoted 10 lines
testsuite/smokey/y2038/syscall-tests.c +10
-0+if (ret) +return -errno; + + next.tv_sec = ts1.tv_sec + interval; + next.tv_nsec = ts1.tv_nsec; + + ret =XENOMAI_SYSCALL4 (sc_nr,CLOCK_MONOTONIC ,TIMER_ABSTIME , + &next, (void *)0xdeadbeefUL ); +if (!smokey_assert (!ret)) +return ret ? ret : -EINVAL ;Unneeded test here - ret is != 0.
Quoted 6 lines
testsuite/smokey/y2038/syscall-tests.c +6
-0+ + ret =clock_gettime (CLOCK_MONOTONIC , &ts2); +if (ret) +return -errno; + +timespec_sub (&delta, &ts2, &ts1);testsuite/smokey/y2038/syscall-tests.c static int test_sc_cobalt_clock_settime64(void) · line 295
Quoted 10 lines
testsuite/smokey/y2038/syscall-tests.c +10
-0+if (delta.tv_sec < interval) +smokey_warning ("nanosleep didn't sleep long enough." ); + +/* Provide a valid 64bit timespec, round 2*/ + next.tv_sec = ts2.tv_sec + interval; + next.tv_nsec = ts2.tv_nsec; + + ret =XENOMAI_SYSCALL4 (sc_nr,CLOCK_MONOTONIC ,TIMER_ABSTIME , &next, &rmt); +if (!smokey_assert (!ret)) +return ret ? ret : -EINVAL ;Same here.
Quoted 5 lines
Quoted 2 lines
I can fix those up - once I understood why they trigger here ATM.
In fact, if we want to return the real error, errno needs to be consulted. What is the intention then?
Err, no, it's direct syscall invocation, no errno at this point yet.
Found the reason for the failing test meanwhile: I was on wip/dovetail already, and there we have
Quoted 7 lines
static inline int
pipeline_set_wallclock(xnticks_t epoch_ns){ return -EOPNOTSUPP; }Philippe, any particular reason for this?
Yes, because setting the wallclock from oob context over Dovetail does not make sense because Xenomai shares the time base with the common kernel when running on top of Dovetail. The latter can jump to the vDSO for reading time using the common services on the regular time base, but setting that time base does require a regular in-band context.
What you could do is handing the clock_settime request over to the glibc instead, but that would entail a stage switch to in-band then.
Signature · 1 line
Philippe.
Quoted 28 lines · Florian Bezdeka
Hi!
This is the next set of changes needed for solving the y2038 problem. Most patches were provided by Song. I reviewed them and fixed some error handling problems as well as test failures on some architectures. Some of the tests were rebased on top of the current next branch.
With this series applied the wip/dovetail and florian/y2038 [1] branches are merge-able without conflicts.
Best regards,
Florian[1] https://gitlab.com/Xenomai/xenomai-hacker-space/-/tree/florian/y2038
Florian Bezdeka (1):
y2038: libcobalt: Centralizesc_cobalt_clock_gettimesyscallchensong (8):
y2038: cobalt/posix/clock: Addingclock_gettime64
y2038: cobalt/posix/clock: Addingclock_settime64
y2038:lib/cobalt/clock: dispatchclock_gettime
y2038:lib/cobalt/clock: dispatchclock_settime
y2038: testsuite/smokey/y2038: testcase for settime64 and gettime64
y2038: cobalt/posix/clock: Addingclock_nanosleep64
y2038:lib/cobalt/clock: dispatchclock_nanosleep
y2038: testsuite/smokey/y2038: Adding testcase for nanosleep64
Quoted 11 lines
include/cobalt/kernel/time.h | 11 ++ include/cobalt/uapi/syscall.h | 3 + kernel/cobalt/posix/clock.c | 70 +++++++++++- kernel/cobalt/posix/clock.h | 22 ++++ kernel/cobalt/posix/syscall32.c | 23 ++++ kernel/cobalt/posix/syscall32.h | 14 +++ kernel/cobalt/time.c | 11 ++ lib/cobalt/clock.c | 22 +++- testsuite/smokey/y2038/syscall-tests.c | 151 +++++++++++++++++++++++++ 9 files changed, 324 insertions(+), 3 deletions(-)
Thanks, applied to next. A tiny cleanup patch for the error test will follow on top.
As I just found out: clock_settime does not work with dovetail yet. So the testsuite will fail over wip/dovetail for the time being.
Jan
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux