y2038: testsuite/smokey/y2038: replace syscall with XENOMAI_SYSCALL
PATCH 1/1 y2038: testsuite/smokey/y2038: replace syscall with XENOMAI_SYSCALL
replace syscall with XENOMAI_SYSCALL and handle return value differently
--- testsuite/smokey/y2038/syscall-tests.c | 128 +++++++++++++++------------------ 1 file changed, 56 insertions(+), 72 deletions(-)
testsuite/smokey/y2038/syscall-tests.c +56 -72
@@ -246,23 +246,23 @@ static int __mutex_timdlock64(pthread_mutex_t *lock) ret =pthread_mutex_lock (lock);if (ret) -return errno; +return -errno; ret =pthread_create (&tid,NULL , __mutex_timedlock64_thread, lock);if (ret) -return errno; +return -errno; ret =pthread_join (tid,NULL );if (ret) -return errno; +return -errno; ret =pthread_mutex_unlock (lock);if (ret) -return errno; +return -errno; ret =pthread_mutex_destroy (lock);if (ret) -return errno; +return -errno;return 0 ; }
@@ -329,7 +329,7 @@ static int test_sc_cobalt_mutex_timedlock64(void)*/ ret =__mutex_timdlock64 (&lock);if (ret) -return errno; +return -errno;return 0 ; }
@@ -341,23 +341,21 @@ static int test_sc_cobalt_clock_gettime64(void)struct xn_timespec64 ts64;/* Make sure we don't crash because of NULL pointers */ - ret =syscall (code,NULL ,NULL ); -if (ret ==-1 && errno ==ENOSYS ) { + ret =XENOMAI_SYSCALL2 (code,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 ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno;/* Providing an invalid address has to deliver EFAULT */ - ret =syscall (code,CLOCK_MONOTONIC , (void *)0xdeadbeefUL ); -if (!smokey_assert (ret ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno; + ret =XENOMAI_SYSCALL2 (code,CLOCK_MONOTONIC , (void *)0xdeadbeefUL ); +if (!smokey_assert (ret)) +return ret ? ret : -EINVAL ;/* Provide a valid 64bit timespec*/ - ret =syscall (code,CLOCK_MONOTONIC , &ts64); + ret =XENOMAI_SYSCALL2 (code,CLOCK_MONOTONIC , &ts64);if (!smokey_assert (!ret)) -return errno; +return ret ? ret : -EINVAL ;return 0 ; }
@@ -370,31 +368,27 @@ static int test_sc_cobalt_clock_settime64(void)struct timespec now;/* Make sure we don't crash because of NULL pointers */ - ret =syscall (code,NULL ,NULL ); -if (ret ==-1 && errno ==ENOSYS ) { + ret =XENOMAI_SYSCALL2 (code,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 ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno;/* Providing an invalid address has to deliver EFAULT */ - ret =syscall (code,CLOCK_MONOTONIC , (void *)0xdeadbeefUL ); -if (!smokey_assert (ret ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno; + ret =XENOMAI_SYSCALL2 (code,CLOCK_MONOTONIC , (void *)0xdeadbeefUL ); +if (!smokey_assert (ret)) +return ret ? ret : -EINVAL ;/* Provide a valid 64bit timespec*/ ret =clock_gettime (CLOCK_MONOTONIC , &now); -if (ret) { -smokey_warning ("clock_gettime failed in cloc_settime64." ); -return errno; - } +if (ret) +return -errno; - ts64.tv_sec = now.tv_sec; + ts64.tv_sec = now.tv_sec +1 ; ts64.tv_nsec = now.tv_nsec; - ret =syscall (code,CLOCK_MONOTONIC , &ts64); -if (!smokey_assert (!ret)) -return errno; + ret =XENOMAI_SYSCALL2 (code,CLOCK_MONOTONIC , &ts64); +if (!smokey_assert (ret)) +return ret ? ret : -EINVAL ;return 0 ; }
@@ -408,39 +402,34 @@ static int test_sc_cobalt_clock_nanosleep64(void)long interval =1 ;/* Make sure we don't crash because of NULL pointers */ - ret =syscall (code,NULL ,NULL ,NULL ,NULL ); -if (ret ==-1 && errno ==ENOSYS ) { + ret =XENOMAI_SYSCALL4 (code,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 ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno;/* Providing an invalid address has to deliver EFAULT */ - ret =syscall (code,CLOCK_MONOTONIC ,TIMER_ABSTIME , + ret =XENOMAI_SYSCALL4 (code,CLOCK_MONOTONIC ,TIMER_ABSTIME , (void *)0xdeadbeefUL , &rmt); -if (!smokey_assert (ret ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno; +if (!smokey_assert (ret)) +return ret ? ret : -EINVAL ;/* Provide a valid 64bit timespec, round 1*/ ret =clock_gettime (CLOCK_MONOTONIC , &ts1); -if (ret) { -smokey_warning ("clock_gettime failed in clock_nanosleep64." ); -return errno; - } +if (ret) +return -errno; + next.tv_sec = ts1.tv_sec + interval; next.tv_nsec = ts1.tv_nsec; - ret =syscall (code,CLOCK_MONOTONIC ,TIMER_ABSTIME , + ret =XENOMAI_SYSCALL4 (code,CLOCK_MONOTONIC ,TIMER_ABSTIME , &next, (void *)0xdeadbeefUL );if (!smokey_assert (!ret)) -return errno; +return ret ? ret : -EINVAL ; ret =clock_gettime (CLOCK_MONOTONIC , &ts2); -if (ret) { -smokey_warning ("clock_gettime failed in clock_nanosleep64." ); -return errno; - } +if (ret) +return -errno;timespec_sub (&delta, &ts2, &ts1);if (delta.tv_sec < interval)
@@ -450,15 +439,13 @@ static int test_sc_cobalt_clock_nanosleep64(void) next.tv_sec = ts2.tv_sec + interval; next.tv_nsec = ts2.tv_nsec; - ret =syscall (code,CLOCK_MONOTONIC ,TIMER_ABSTIME , &next, &rmt); + ret =XENOMAI_SYSCALL4 (code,CLOCK_MONOTONIC ,TIMER_ABSTIME , &next, &rmt);if (!smokey_assert (!ret)) -return errno; +return ret ? ret : -EINVAL ; ret =clock_gettime (CLOCK_MONOTONIC , &ts1); -if (ret) { -smokey_warning ("clock_gettime failed in clock_nanosleep64." ); -return errno; - } +if (ret) +return -errno;timespec_sub (&delta, &ts1, &ts2);if (delta.tv_sec < interval)
@@ -474,23 +461,22 @@ static int test_sc_cobalt_clock_getres64(void)struct xn_timespec64 ts64;/* Make sure we don't crash because of NULL pointers */ - ret =syscall (code,NULL ,NULL ); -if (ret ==-1 && errno ==ENOSYS ) { + ret =XENOMAI_SYSCALL2 (code,NULL ,NULL ); +if (ret == -ENOSYS ) {smokey_note ("clock_getres64: skipped. (no kernel support)" );return 0 ;// Not implemented, nothing to test, success } -if (!smokey_assert (ret ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno;/* Providing an invalid address has to deliver EFAULT */ - ret =syscall (code,CLOCK_MONOTONIC , (void *)0xdeadbeefUL ); -if (!smokey_assert (ret ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno; + ret =XENOMAI_SYSCALL2 (code,CLOCK_MONOTONIC , (void *)0xdeadbeefUL ); +if (!smokey_assert (ret)) +return ret ? ret : -EINVAL ;/* Provide a valid 64bit timespec*/ - ret =syscall (code,CLOCK_MONOTONIC , &ts64); + ret =XENOMAI_SYSCALL2 (code,CLOCK_MONOTONIC , &ts64);if (!smokey_assert (!ret)) -return errno; +return ret ? ret : -EINVAL ; +if (ts64.tv_sec !=0 || ts64.tv_nsec !=1 )smokey_warning ("High resolution timers not available\n" );
@@ -504,25 +490,23 @@ static int test_sc_cobalt_clock_adjtime64(void)struct xn_timex64 tx64 = {};/* Make sure we don't crash because of NULL pointers */ - ret =syscall (code,NULL ,NULL ); -if (ret ==-1 && errno ==ENOSYS ) { + ret =XENOMAI_SYSCALL2 (code,NULL ,NULL ); +if (ret == -ENOSYS ) {smokey_note ("clock_adjtime64: skipped. (no kernel support)" );return 0 ;// Not implemented, nothing to test, success } -if (!smokey_assert (ret ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno;/* Providing an invalid address has to deliver EFAULT */ - ret =syscall (code,CLOCK_REALTIME , (void *)0xdeadbeefUL ); -if (!smokey_assert (ret ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno; + ret =XENOMAI_SYSCALL2 (code,CLOCK_REALTIME , (void *)0xdeadbeefUL ); +if (!smokey_assert (ret)) +return ret ? ret : -EINVAL ;/* Provide a valid 64bit timex*/ tx64.modes =ADJ_SETOFFSET ; tx64.time.tv_usec =123 ; - ret =syscall (code,CLOCK_REALTIME , &tx64); -if (!smokey_assert (!ret)) -return errno; + ret =XENOMAI_SYSCALL2 (code,CLOCK_REALTIME , &tx64); +if (!smokey_assert (ret)) +return ret ? ret : -EINVAL ;return 0 ; }
Signature · 1 line
2.7.4
Quoted 252 lines · Song Chen via Xenomai
replace syscall with
XENOMAI_SYSCALLand handle return value differentlySigned-off-by Song Chen <[email protected]>--- testsuite/smokey/y2038/syscall-tests.c | 128 +++++++++++++++------------------ 1 file changed, 56 insertions(+), 72 deletions(-)testsuite/smokey/y2038/syscall-tests.c +53
-69@@ -246,23 +246,23 @@ static int __mutex_timdlock64(pthread_mutex_t *lock) ret =pthread_mutex_lock (lock);if (ret) -return errno; +return -errno; ret =pthread_create (&tid,NULL , __mutex_timedlock64_thread, lock);if (ret) -return errno; +return -errno; ret =pthread_join (tid,NULL );if (ret) -return errno; +return -errno; ret =pthread_mutex_unlock (lock);if (ret) -return errno; +return -errno; ret =pthread_mutex_destroy (lock);if (ret) -return errno; +return -errno;return 0 ; }@@ -329,7 +329,7 @@ static int test_sc_cobalt_mutex_timedlock64(void)*/ ret =__mutex_timdlock64 (&lock);if (ret) -return errno; +return -errno;return 0 ; }@@ -341,23 +341,21 @@ static int test_sc_cobalt_clock_gettime64(void)struct xn_timespec64 ts64;/* Make sure we don't crash because of NULL pointers */ - ret =syscall (code,NULL ,NULL ); -if (ret ==-1 && errno ==ENOSYS ) { + ret =XENOMAI_SYSCALL2 (code,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 ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno;/* Providing an invalid address has to deliver EFAULT */ - ret =syscall (code,CLOCK_MONOTONIC , (void *)0xdeadbeefUL ); -if (!smokey_assert (ret ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno; + ret =XENOMAI_SYSCALL2 (code,CLOCK_MONOTONIC , (void *)0xdeadbeefUL ); +if (!smokey_assert (ret)) +return ret ? ret : -EINVAL ;/* Provide a valid 64bit timespec*/ - ret =syscall (code,CLOCK_MONOTONIC , &ts64); + ret =XENOMAI_SYSCALL2 (code,CLOCK_MONOTONIC , &ts64);if (!smokey_assert (!ret)) -return errno; +return ret ? ret : -EINVAL ;return 0 ; }@@ -370,31 +368,27 @@ static int test_sc_cobalt_clock_settime64(void)struct timespec now;/* Make sure we don't crash because of NULL pointers */ - ret =syscall (code,NULL ,NULL ); -if (ret ==-1 && errno ==ENOSYS ) { + ret =XENOMAI_SYSCALL2 (code,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 ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno;/* Providing an invalid address has to deliver EFAULT */ - ret =syscall (code,CLOCK_MONOTONIC , (void *)0xdeadbeefUL ); -if (!smokey_assert (ret ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno; + ret =XENOMAI_SYSCALL2 (code,CLOCK_MONOTONIC , (void *)0xdeadbeefUL ); +if (!smokey_assert (ret)) +return ret ? ret : -EINVAL ;/* Provide a valid 64bit timespec*/ ret =clock_gettime (CLOCK_MONOTONIC , &now); -if (ret) { -smokey_warning ("clock_gettime failed in cloc_settime64." ); -return errno; - } +if (ret) +return -errno; - ts64.tv_sec = now.tv_sec; + ts64.tv_sec = now.tv_sec +1 ; ts64.tv_nsec = now.tv_nsec; - ret =syscall (code,CLOCK_MONOTONIC , &ts64); -if (!smokey_assert (!ret)) -return errno; + ret =XENOMAI_SYSCALL2 (code,CLOCK_MONOTONIC , &ts64); +if (!smokey_assert (ret)) +return ret ? ret : -EINVAL ;return 0 ; }@@ -408,39 +402,34 @@ static int test_sc_cobalt_clock_nanosleep64(void)long interval =1 ;/* Make sure we don't crash because of NULL pointers */ - ret =syscall (code,NULL ,NULL ,NULL ,NULL ); -if (ret ==-1 && errno ==ENOSYS ) { + ret =XENOMAI_SYSCALL4 (code,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 ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno;/* Providing an invalid address has to deliver EFAULT */ - ret =syscall (code,CLOCK_MONOTONIC ,TIMER_ABSTIME , + ret =XENOMAI_SYSCALL4 (code,CLOCK_MONOTONIC ,TIMER_ABSTIME , (void *)0xdeadbeefUL , &rmt); -if (!smokey_assert (ret ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno; +if (!smokey_assert (ret)) +return ret ? ret : -EINVAL ;/* Provide a valid 64bit timespec, round 1*/ ret =clock_gettime (CLOCK_MONOTONIC , &ts1); -if (ret) { -smokey_warning ("clock_gettime failed in clock_nanosleep64." ); -return errno; - } +if (ret) +return -errno; + next.tv_sec = ts1.tv_sec + interval; next.tv_nsec = ts1.tv_nsec; - ret =syscall (code,CLOCK_MONOTONIC ,TIMER_ABSTIME , + ret =XENOMAI_SYSCALL4 (code,CLOCK_MONOTONIC ,TIMER_ABSTIME , &next, (void *)0xdeadbeefUL );if (!smokey_assert (!ret)) -return errno; +return ret ? ret : -EINVAL ; ret =clock_gettime (CLOCK_MONOTONIC , &ts2); -if (ret) { -smokey_warning ("clock_gettime failed in clock_nanosleep64." ); -return errno; - } +if (ret) +return -errno;timespec_sub (&delta, &ts2, &ts1);if (delta.tv_sec < interval)@@ -450,15 +439,13 @@ static int test_sc_cobalt_clock_nanosleep64(void) next.tv_sec = ts2.tv_sec + interval; next.tv_nsec = ts2.tv_nsec; - ret =syscall (code,CLOCK_MONOTONIC ,TIMER_ABSTIME , &next, &rmt); + ret =XENOMAI_SYSCALL4 (code,CLOCK_MONOTONIC ,TIMER_ABSTIME , &next, &rmt);if (!smokey_assert (!ret)) -return errno; +return ret ? ret : -EINVAL ; ret =clock_gettime (CLOCK_MONOTONIC , &ts1); -if (ret) { -smokey_warning ("clock_gettime failed in clock_nanosleep64." ); -return errno; - } +if (ret) +return -errno;timespec_sub (&delta, &ts1, &ts2);if (delta.tv_sec < interval)@@ -474,23 +461,22 @@ static int test_sc_cobalt_clock_getres64(void)struct xn_timespec64 ts64;/* Make sure we don't crash because of NULL pointers */ - ret =syscall (code,NULL ,NULL ); -if (ret ==-1 && errno ==ENOSYS ) { + ret =XENOMAI_SYSCALL2 (code,NULL ,NULL ); +if (ret == -ENOSYS ) {smokey_note ("clock_getres64: skipped. (no kernel support)" );return 0 ;// Not implemented, nothing to test, success } -if (!smokey_assert (ret ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno;/* Providing an invalid address has to deliver EFAULT */ - ret =syscall (code,CLOCK_MONOTONIC , (void *)0xdeadbeefUL ); -if (!smokey_assert (ret ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno; + ret =XENOMAI_SYSCALL2 (code,CLOCK_MONOTONIC , (void *)0xdeadbeefUL ); +if (!smokey_assert (ret)) +return ret ? ret : -EINVAL ;/* Provide a valid 64bit timespec*/ - ret =syscall (code,CLOCK_MONOTONIC , &ts64); + ret =XENOMAI_SYSCALL2 (code,CLOCK_MONOTONIC , &ts64);if (!smokey_assert (!ret)) -return errno; +return ret ? ret : -EINVAL ; +if (ts64.tv_sec !=0 || ts64.tv_nsec !=1 )smokey_warning ("High resolution timers not available\n" );@@ -504,25 +490,23 @@ static int test_sc_cobalt_clock_adjtime64(void)struct xn_timex64 tx64 = {};/* Make sure we don't crash because of NULL pointers */ - ret =syscall (code,NULL ,NULL ); -if (ret ==-1 && errno ==ENOSYS ) { + ret =XENOMAI_SYSCALL2 (code,NULL ,NULL ); +if (ret == -ENOSYS ) {smokey_note ("clock_adjtime64: skipped. (no kernel support)" );return 0 ;// Not implemented, nothing to test, success } -if (!smokey_assert (ret ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno;/* Providing an invalid address has to deliver EFAULT */ - ret =syscall (code,CLOCK_REALTIME , (void *)0xdeadbeefUL ); -if (!smokey_assert (ret ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno; + ret =XENOMAI_SYSCALL2 (code,CLOCK_REALTIME , (void *)0xdeadbeefUL ); +if (!smokey_assert (ret)) +return ret ? ret : -EINVAL ;/* Provide a valid 64bit timex*/ tx64.modes =ADJ_SETOFFSET ;
testsuite/smokey/y2038/syscall-tests.c static int test_sc_cobalt_clock_adjtime64(void) · line 512
Quoted 10 lines
testsuite/smokey/y2038/syscall-tests.c +3
-3tx64.time.tv_usec =123 ; - ret =syscall (code,CLOCK_REALTIME , &tx64); -if (!smokey_assert (!ret)) -return errno; + ret =XENOMAI_SYSCALL2 (code,CLOCK_REALTIME , &tx64); +if (!smokey_assert (ret)) +return ret ? ret : -EINVAL ;return 0 ; }
What is the baseline of this? It seems to be an unmerged patch, thus you rather want to send out a new version of that other patch, including this fix.
Jan
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux
Quoted 260 lines · Jan Kiszka
Quoted 259 lines · Song Chen via Xenomai
replace syscall with
XENOMAI_SYSCALLand handle return value differentlySigned-off-by Song Chen <[email protected]>--- testsuite/smokey/y2038/syscall-tests.c | 128 +++++++++++++++------------------ 1 file changed, 56 insertions(+), 72 deletions(-)testsuite/smokey/y2038/syscall-tests.c +56
-72@@ -246,23 +246,23 @@ static int __mutex_timdlock64(pthread_mutex_t *lock) ret =pthread_mutex_lock (lock);if (ret) -return errno; +return -errno; ret =pthread_create (&tid,NULL , __mutex_timedlock64_thread, lock);if (ret) -return errno; +return -errno; ret =pthread_join (tid,NULL );if (ret) -return errno; +return -errno; ret =pthread_mutex_unlock (lock);if (ret) -return errno; +return -errno; ret =pthread_mutex_destroy (lock);if (ret) -return errno; +return -errno;return 0 ; }@@ -329,7 +329,7 @@ static int test_sc_cobalt_mutex_timedlock64(void)*/ ret =__mutex_timdlock64 (&lock);if (ret) -return errno; +return -errno;return 0 ; }@@ -341,23 +341,21 @@ static int test_sc_cobalt_clock_gettime64(void)struct xn_timespec64 ts64;/* Make sure we don't crash because of NULL pointers */ - ret =syscall (code,NULL ,NULL ); -if (ret ==-1 && errno ==ENOSYS ) { + ret =XENOMAI_SYSCALL2 (code,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 ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno;/* Providing an invalid address has to deliver EFAULT */ - ret =syscall (code,CLOCK_MONOTONIC , (void *)0xdeadbeefUL ); -if (!smokey_assert (ret ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno; + ret =XENOMAI_SYSCALL2 (code,CLOCK_MONOTONIC , (void *)0xdeadbeefUL ); +if (!smokey_assert (ret)) +return ret ? ret : -EINVAL ;/* Provide a valid 64bit timespec*/ - ret =syscall (code,CLOCK_MONOTONIC , &ts64); + ret =XENOMAI_SYSCALL2 (code,CLOCK_MONOTONIC , &ts64);if (!smokey_assert (!ret)) -return errno; +return ret ? ret : -EINVAL ;return 0 ; }@@ -370,31 +368,27 @@ static int test_sc_cobalt_clock_settime64(void)struct timespec now;/* Make sure we don't crash because of NULL pointers */ - ret =syscall (code,NULL ,NULL ); -if (ret ==-1 && errno ==ENOSYS ) { + ret =XENOMAI_SYSCALL2 (code,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 ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno;/* Providing an invalid address has to deliver EFAULT */ - ret =syscall (code,CLOCK_MONOTONIC , (void *)0xdeadbeefUL ); -if (!smokey_assert (ret ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno; + ret =XENOMAI_SYSCALL2 (code,CLOCK_MONOTONIC , (void *)0xdeadbeefUL ); +if (!smokey_assert (ret)) +return ret ? ret : -EINVAL ;/* Provide a valid 64bit timespec*/ ret =clock_gettime (CLOCK_MONOTONIC , &now); -if (ret) { -smokey_warning ("clock_gettime failed in cloc_settime64." ); -return errno; - } +if (ret) +return -errno; - ts64.tv_sec = now.tv_sec; + ts64.tv_sec = now.tv_sec +1 ; ts64.tv_nsec = now.tv_nsec; - ret =syscall (code,CLOCK_MONOTONIC , &ts64); -if (!smokey_assert (!ret)) -return errno; + ret =XENOMAI_SYSCALL2 (code,CLOCK_MONOTONIC , &ts64); +if (!smokey_assert (ret)) +return ret ? ret : -EINVAL ;return 0 ; }@@ -408,39 +402,34 @@ static int test_sc_cobalt_clock_nanosleep64(void)long interval =1 ;/* Make sure we don't crash because of NULL pointers */ - ret =syscall (code,NULL ,NULL ,NULL ,NULL ); -if (ret ==-1 && errno ==ENOSYS ) { + ret =XENOMAI_SYSCALL4 (code,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 ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno;/* Providing an invalid address has to deliver EFAULT */ - ret =syscall (code,CLOCK_MONOTONIC ,TIMER_ABSTIME , + ret =XENOMAI_SYSCALL4 (code,CLOCK_MONOTONIC ,TIMER_ABSTIME , (void *)0xdeadbeefUL , &rmt); -if (!smokey_assert (ret ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno; +if (!smokey_assert (ret)) +return ret ? ret : -EINVAL ;/* Provide a valid 64bit timespec, round 1*/ ret =clock_gettime (CLOCK_MONOTONIC , &ts1); -if (ret) { -smokey_warning ("clock_gettime failed in clock_nanosleep64." ); -return errno; - } +if (ret) +return -errno; + next.tv_sec = ts1.tv_sec + interval; next.tv_nsec = ts1.tv_nsec; - ret =syscall (code,CLOCK_MONOTONIC ,TIMER_ABSTIME , + ret =XENOMAI_SYSCALL4 (code,CLOCK_MONOTONIC ,TIMER_ABSTIME , &next, (void *)0xdeadbeefUL );if (!smokey_assert (!ret)) -return errno; +return ret ? ret : -EINVAL ; ret =clock_gettime (CLOCK_MONOTONIC , &ts2); -if (ret) { -smokey_warning ("clock_gettime failed in clock_nanosleep64." ); -return errno; - } +if (ret) +return -errno;timespec_sub (&delta, &ts2, &ts1);if (delta.tv_sec < interval)@@ -450,15 +439,13 @@ static int test_sc_cobalt_clock_nanosleep64(void) next.tv_sec = ts2.tv_sec + interval; next.tv_nsec = ts2.tv_nsec; - ret =syscall (code,CLOCK_MONOTONIC ,TIMER_ABSTIME , &next, &rmt); + ret =XENOMAI_SYSCALL4 (code,CLOCK_MONOTONIC ,TIMER_ABSTIME , &next, &rmt);if (!smokey_assert (!ret)) -return errno; +return ret ? ret : -EINVAL ; ret =clock_gettime (CLOCK_MONOTONIC , &ts1); -if (ret) { -smokey_warning ("clock_gettime failed in clock_nanosleep64." ); -return errno; - } +if (ret) +return -errno;timespec_sub (&delta, &ts1, &ts2);if (delta.tv_sec < interval)@@ -474,23 +461,22 @@ static int test_sc_cobalt_clock_getres64(void)struct xn_timespec64 ts64;/* Make sure we don't crash because of NULL pointers */ - ret =syscall (code,NULL ,NULL ); -if (ret ==-1 && errno ==ENOSYS ) { + ret =XENOMAI_SYSCALL2 (code,NULL ,NULL ); +if (ret == -ENOSYS ) {smokey_note ("clock_getres64: skipped. (no kernel support)" );return 0 ;// Not implemented, nothing to test, success } -if (!smokey_assert (ret ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno;/* Providing an invalid address has to deliver EFAULT */ - ret =syscall (code,CLOCK_MONOTONIC , (void *)0xdeadbeefUL ); -if (!smokey_assert (ret ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno; + ret =XENOMAI_SYSCALL2 (code,CLOCK_MONOTONIC , (void *)0xdeadbeefUL ); +if (!smokey_assert (ret)) +return ret ? ret : -EINVAL ;/* Provide a valid 64bit timespec*/ - ret =syscall (code,CLOCK_MONOTONIC , &ts64); + ret =XENOMAI_SYSCALL2 (code,CLOCK_MONOTONIC , &ts64);if (!smokey_assert (!ret)) -return errno; +return ret ? ret : -EINVAL ; +if (ts64.tv_sec !=0 || ts64.tv_nsec !=1 )smokey_warning ("High resolution timers not available\n" );@@ -504,25 +490,23 @@ static int test_sc_cobalt_clock_adjtime64(void)struct xn_timex64 tx64 = {};/* Make sure we don't crash because of NULL pointers */ - ret =syscall (code,NULL ,NULL ); -if (ret ==-1 && errno ==ENOSYS ) { + ret =XENOMAI_SYSCALL2 (code,NULL ,NULL ); +if (ret == -ENOSYS ) {smokey_note ("clock_adjtime64: skipped. (no kernel support)" );return 0 ;// Not implemented, nothing to test, success } -if (!smokey_assert (ret ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno;/* Providing an invalid address has to deliver EFAULT */ - ret =syscall (code,CLOCK_REALTIME , (void *)0xdeadbeefUL ); -if (!smokey_assert (ret ==-1 ) || !smokey_assert (errno ==EFAULT )) -return errno; + ret =XENOMAI_SYSCALL2 (code,CLOCK_REALTIME , (void *)0xdeadbeefUL ); +if (!smokey_assert (ret)) +return ret ? ret : -EINVAL ;/* Provide a valid 64bit timex*/ tx64.modes =ADJ_SETOFFSET ; tx64.time.tv_usec =123 ; - ret =syscall (code,CLOCK_REALTIME , &tx64); -if (!smokey_assert (!ret)) -return errno; + ret =XENOMAI_SYSCALL2 (code,CLOCK_REALTIME , &tx64); +if (!smokey_assert (ret)) +return ret ? ret : -EINVAL ;
Quoted 5 lines
testsuite/smokey/y2038/syscall-tests.c static int test_sc_cobalt_clock_adjtime64(void) · line 512
Quoted 3 lines
testsuite/smokey/y2038/syscall-tests.c +0
-0return 0 ; }What is the baseline of this? It seems to be an unmerged patch, thus you
yes, you are right, it's based on my unmerged patches, Florian will merge them on [1] soon and this is the last one.
baseline is [1], branch: florian/y2038. [1]:[email protected]:Xenomai/xenomai-hacker-space.git
Song
Quoted 5 lines
rather want to send out a new version of that other patch, including this fix.
Jan
Quoted 245 lines · On 25.05.21 09:13, [email protected] wrote:
Quoted 233 lines · Jan Kiszka
Quoted 232 lines · Song Chen via Xenomai
replace syscall with
XENOMAI_SYSCALLand handle return value differentlySigned-off-by Song Chen <[email protected]>---
testsuite/smokey/y2038/syscall-tests.c| 128
+++++++++++++++------------------1 file changed, 56 insertions(+), 72 deletions(-)testsuite/smokey/y2038/syscall-tests.c +8
-8@@ -246,23 +246,23 @@ static int __mutex_timdlock64(pthread_mutex_t *lock) ret = pthread_mutex_lock(lock); if (ret) - return errno; + return -errno; ret = pthread_create(&tid, NULL, __mutex_timedlock64_thread, lock); if (ret) - return errno; + return -errno; ret = pthread_join(tid, NULL); if (ret) - return errno; + return -errno; ret = pthread_mutex_unlock(lock); if (ret) - return errno; + return -errno; ret = pthread_mutex_destroy(lock); if (ret) - return errno; + return -errno; return 0; }@@ -329,7 +329,7 @@ static int test_sc_cobalt_mutex_timedlock64(void)*/ ret = __mutex_timdlock64(&lock); if (ret) - return errno; + return -errno; return 0; }@@ -341,23 +341,21 @@ static int test_sc_cobalt_clock_gettime64(void) struct xn_timespec64 ts64; /* Make sure we don't crash because of NULL pointers */ - ret = syscall(code, NULL, NULL); - if (ret == -1 && errno == ENOSYS) { + ret = XENOMAI_SYSCALL2(code, 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 == -1) || !smokey_assert(errno == EFAULT)) - return errno;
/* Providing an invalid address has to deliver EFAULT */ - ret =syscall(code, CLOCK_MONOTONIC, (void *)0xdeadbeefUL); - if (!smokey_assert(ret == -1) || !smokey_assert(errno == EFAULT)) - return errno;
+ ret =XENOMAI_SYSCALL2(code, CLOCK_MONOTONIC, (void *)0xdeadbeefUL);
+ if (!smokey_assert(ret))
+ return ret ? ret :-EINVAL;
/* Provide a valid 64bit timespec*/
- ret =syscall(code, CLOCK_MONOTONIC, &ts64);
+ ret =XENOMAI_SYSCALL2(code, CLOCK_MONOTONIC, &ts64); if (!smokey_assert(!ret))
- return errno;
+ return ret ? ret :-EINVAL;
return 0;
}testsuite/smokey/y2038/syscall-tests.c +2
-2@@ -370,31 +368,27 @@ static int test_sc_cobalt_clock_settime64(void) struct timespec now; /* Make sure we don't crash because of NULL pointers */ - ret = syscall(code, NULL, NULL); - if (ret == -1 && errno == ENOSYS) { + ret = XENOMAI_SYSCALL2(code, 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 == -1) || !smokey_assert(errno == EFAULT)) - return errno;
/* Providing an invalid address has to deliver EFAULT */ - ret =syscall(code, CLOCK_MONOTONIC, (void *)0xdeadbeefUL); - if (!smokey_assert(ret == -1) || !smokey_assert(errno == EFAULT)) - return errno;
+ ret =XENOMAI_SYSCALL2(code, CLOCK_MONOTONIC, (void *)0xdeadbeefUL);
+ if (!smokey_assert(ret))
+ return ret ? ret :-EINVAL;
/* Provide a valid 64bit timespec*/
ret =clock_gettime(CLOCK_MONOTONIC, &now);
- if (ret) {
-smokey_warning("clock_gettime failed in cloc_settime64."); - return errno;
- }
+ if (ret)
+ return -errno;
- ts64.tv_sec = now.tv_sec;
+ ts64.tv_sec = now.tv_sec + 1;
ts64.tv_nsec = now.tv_nsec;
- ret =syscall(code, CLOCK_MONOTONIC, &ts64);
- if (!smokey_assert(!ret))
- return errno;
+ ret =XENOMAI_SYSCALL2(code, CLOCK_MONOTONIC, &ts64); + if (!smokey_assert(ret))
+ return ret ? ret :-EINVAL;
return 0;
}testsuite/smokey/y2038/syscall-tests.c +2
-2@@ -408,39 +402,34 @@ static int test_sc_cobalt_clock_nanosleep64(void) long interval = 1; /* Make sure we don't crash because of NULL pointers */ - ret = syscall(code, NULL, NULL, NULL, NULL); - if (ret == -1 && errno == ENOSYS) { + ret = XENOMAI_SYSCALL4(code, 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 == -1) || !smokey_assert(errno == EFAULT)) - return errno;
/* Providing an invalid address has to deliver EFAULT */ - ret = syscall(code,CLOCK_MONOTONIC,TIMER_ABSTIME,
+ ret =XENOMAI_SYSCALL4(code, CLOCK_MONOTONIC, TIMER_ABSTIME, (void *)0xdeadbeefUL, &rmt);
- if (!smokey_assert(ret == -1) || !smokey_assert(errno == EFAULT)) - return errno;
+ if (!smokey_assert(ret))
+ return ret ? ret :-EINVAL;
/* Provide a valid 64bit timespec, round 1*/
ret =clock_gettime(CLOCK_MONOTONIC, &ts1);
- if (ret) {
-smokey_warning("clock_gettime failed in clock_nanosleep64."); - return errno;
- }
+ if (ret)
+ return -errno;
+
next.tv_sec = ts1.tv_sec + interval;
next.tv_nsec = ts1.tv_nsec;
- ret = syscall(code,CLOCK_MONOTONIC,TIMER_ABSTIME, + ret =XENOMAI_SYSCALL4(code, CLOCK_MONOTONIC, TIMER_ABSTIME, &next, (void *)0xdeadbeefUL);
if (!smokey_assert(!ret))
- return errno;
+ return ret ? ret :-EINVAL;
ret =clock_gettime(CLOCK_MONOTONIC, &ts2);
- if (ret) {
-smokey_warning("clock_gettime failed in clock_nanosleep64."); - return errno;
- }
+ if (ret)
+ return -errno;
timespec_sub(&delta, &ts2, &ts1);
if (delta.tv_sec < interval)testsuite/smokey/y2038/syscall-tests.c +6
-7@@ -450,15 +439,13 @@ static int test_sc_cobalt_clock_nanosleep64(void) next.tv_sec = ts2.tv_sec + interval; next.tv_nsec = ts2.tv_nsec; - ret = syscall(code, CLOCK_MONOTONIC, TIMER_ABSTIME, &next, &rmt); + ret = XENOMAI_SYSCALL4(code, CLOCK_MONOTONIC, TIMER_ABSTIME, &next, &rmt); if (!smokey_assert(!ret)) - return errno; + return ret ? ret : -EINVAL; ret = clock_gettime(CLOCK_MONOTONIC, &ts1); - if (ret) { - smokey_warning("clock_gettime failed in clock_nanosleep64."); - return errno; - } + if (ret) + return -errno; timespec_sub(&delta, &ts1, &ts2); if (delta.tv_sec < interval)@@ -474,23 +461,22 @@ static int test_sc_cobalt_clock_getres64(void) struct xn_timespec64 ts64; /* Make sure we don't crash because of NULL pointers */ - ret = syscall(code, NULL, NULL); - if (ret == -1 && errno == ENOSYS) { + ret = XENOMAI_SYSCALL2(code, NULL, NULL); + if (ret == -ENOSYS) { smokey_note("clock_getres64: skipped. (no kernel support)");return 0; // Not implemented, nothing to test, success }
- if (!smokey_assert(ret == -1) || !smokey_assert(errno == EFAULT)) - return errno;
/* Providing an invalid address has to deliver EFAULT */ - ret =syscall(code, CLOCK_MONOTONIC, (void *)0xdeadbeefUL); - if (!smokey_assert(ret == -1) || !smokey_assert(errno == EFAULT)) - return errno;
+ ret =XENOMAI_SYSCALL2(code, CLOCK_MONOTONIC, (void *)0xdeadbeefUL);
+ if (!smokey_assert(ret))
+ return ret ? ret :-EINVAL;
/* Provide a valid 64bit timespec*/
- ret =syscall(code, CLOCK_MONOTONIC, &ts64);
+ ret =XENOMAI_SYSCALL2(code, CLOCK_MONOTONIC, &ts64); if (!smokey_assert(!ret))
- return errno;
+ return ret ? ret :-EINVAL;
+
if (ts64.tv_sec != 0 || ts64.tv_nsec != 1)smokey_warning("High resolution timers not available\n"); @@ -504,25 +490,23 @@ static inttest_sc_cobalt_clock_adjtime64(void)structxn_timex64tx64 = {};
/* Make sure we don't crash because of NULL pointers */ - ret =syscall(code, NULL, NULL);
- if (ret == -1 && errno == ENOSYS) {
+ ret =XENOMAI_SYSCALL2(code, NULL, NULL);
+ if (ret ==-ENOSYS) {
smokey_note("clock_adjtime64: skipped. (no kernel support)"); return 0; // Not implemented, nothing to test, success }
- if (!smokey_assert(ret == -1) || !smokey_assert(errno == EFAULT)) - return errno;
/* Providing an invalid address has to deliver EFAULT */ - ret =syscall(code, CLOCK_REALTIME, (void *)0xdeadbeefUL); - if (!smokey_assert(ret == -1) || !smokey_assert(errno == EFAULT)) - return errno;
+ ret =XENOMAI_SYSCALL2(code, CLOCK_REALTIME, (void *)0xdeadbeefUL); + if (!smokey_assert(ret))
+ return ret ? ret :-EINVAL;
/* Provide a valid 64bit timex*/
tx64.modes =ADJ_SETOFFSET;
tx64.time.tv_usec = 123;
- ret =syscall(code, CLOCK_REALTIME, &tx64);
- if (!smokey_assert(!ret))
- return errno;Quoted 8 lines
Quoted 6 lines
+ ret =
XENOMAI_SYSCALL2(code, CLOCK_REALTIME, &tx64); + if (!smokey_assert(ret))
+ return ret ? ret :-EINVAL;
return 0;
}What is the baseline of this? It seems to be an unmerged patch, thus you
Quoted 6 lines
yes, you are right, it's based on my unmerged patches, Florian will merge them on [1] soon and this is the last one.
baseline is [1], branch: florian/y2038. [1]:[email protected]:Xenomai/xenomai-hacker-space.git
Ah, ok - tagging the patches would help, e.g. "[florian/y2038][PATCH] ...".
Jan
Quoted 7 lines
Song
Quoted 5 lines
rather want to send out a new version of that other patch, including this fix.
Jan
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux
Quoted 246 lines · Jan Kiszka
Quoted 245 lines · On 25.05.21 09:13, [email protected] wrote:
Quoted 241 lines · Jan Kiszka
Quoted 228 lines · Song Chen via Xenomai
replace syscall with
XENOMAI_SYSCALLand handle return value differentlySigned-off-by Song Chen <[email protected]>--- testsuite/smokey/y2038/syscall-tests.c | 128 +++++++++++++++------------------ 1 file changed, 56 insertions(+), 72 deletions(-)testsuite/smokey/y2038/syscall-tests.c +53
-66@@ -246,23 +246,23 @@ static int __mutex_timdlock64(pthread_mutex_t *lock) ret = pthread_mutex_lock(lock); if (ret) - return errno; + return -errno; ret = pthread_create(&tid, NULL, __mutex_timedlock64_thread, lock); if (ret) - return errno; + return -errno; ret = pthread_join(tid, NULL); if (ret) - return errno; + return -errno; ret = pthread_mutex_unlock(lock); if (ret) - return errno; + return -errno; ret = pthread_mutex_destroy(lock); if (ret) - return errno; + return -errno; return 0; }@@ -329,7 +329,7 @@ static int test_sc_cobalt_mutex_timedlock64(void)*/ ret = __mutex_timdlock64(&lock); if (ret) - return errno; + return -errno; return 0; }@@ -341,23 +341,21 @@ static int test_sc_cobalt_clock_gettime64(void) struct xn_timespec64 ts64; /* Make sure we don't crash because of NULL pointers */ - ret = syscall(code, NULL, NULL); - if (ret == -1 && errno == ENOSYS) { + ret = XENOMAI_SYSCALL2(code, 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 == -1) || !smokey_assert(errno == EFAULT)) - return errno; /* Providing an invalid address has to deliver EFAULT */ - ret = syscall(code, CLOCK_MONOTONIC, (void *)0xdeadbeefUL); - if (!smokey_assert(ret == -1) || !smokey_assert(errno == EFAULT)) - return errno; + ret = XENOMAI_SYSCALL2(code, CLOCK_MONOTONIC, (void *)0xdeadbeefUL ); + if (!smokey_assert(ret)) + return ret ? ret : -EINVAL; /* Provide a valid 64bit timespec*/ - ret = syscall(code, CLOCK_MONOTONIC, &ts64); + ret = XENOMAI_SYSCALL2(code, CLOCK_MONOTONIC, &ts64); if (!smokey_assert(!ret)) - return errno; + return ret ? ret : -EINVAL; return 0; }@@ -370,31 +368,27 @@ static int test_sc_cobalt_clock_settime64(void) struct timespec now; /* Make sure we don't crash because of NULL pointers */ - ret = syscall(code, NULL, NULL); - if (ret == -1 && errno == ENOSYS) { + ret = XENOMAI_SYSCALL2(code, 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 == -1) || !smokey_assert(errno == EFAULT)) - return errno; /* Providing an invalid address has to deliver EFAULT */ - ret = syscall(code, CLOCK_MONOTONIC, (void *)0xdeadbeefUL); - if (!smokey_assert(ret == -1) || !smokey_assert(errno == EFAULT)) - return errno; + ret = XENOMAI_SYSCALL2(code, CLOCK_MONOTONIC, (void *)0xdeadbeefUL ); + if (!smokey_assert(ret)) + return ret ? ret : -EINVAL; /* Provide a valid 64bit timespec*/ ret = clock_gettime(CLOCK_MONOTONIC, &now); - if (ret) { - smokey_warning("clock_gettime failed in cloc_settime64."); - return errno; - } + if (ret) + return -errno; - ts64.tv_sec = now.tv_sec; + ts64.tv_sec = now.tv_sec + 1; ts64.tv_nsec = now.tv_nsec; - ret = syscall(code, CLOCK_MONOTONIC, &ts64); - if (!smokey_assert(!ret)) - return errno; + ret = XENOMAI_SYSCALL2(code, CLOCK_MONOTONIC, &ts64); + if (!smokey_assert(ret)) + return ret ? ret : -EINVAL; return 0; }@@ -408,39 +402,34 @@ static int test_sc_cobalt_clock_nanosleep64(void) long interval = 1; /* Make sure we don't crash because of NULL pointers */ - ret = syscall(code, NULL, NULL, NULL, NULL); - if (ret == -1 && errno == ENOSYS) { + ret = XENOMAI_SYSCALL4(code, 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 == -1) || !smokey_assert(errno == EFAULT)) - return errno; /* Providing an invalid address has to deliver EFAULT */ - ret = syscall(code, CLOCK_MONOTONIC, TIMER_ABSTIME, + ret = XENOMAI_SYSCALL4(code, CLOCK_MONOTONIC, TIMER_ABSTIME, (void *)0xdeadbeefUL, &rmt); - if (!smokey_assert(ret == -1) || !smokey_assert(errno == EFAULT)) - return errno; + if (!smokey_assert(ret)) + return ret ? ret : -EINVAL; /* Provide a valid 64bit timespec, round 1*/ ret = clock_gettime(CLOCK_MONOTONIC, &ts1); - if (ret) { - smokey_warning("clock_gettime failed in clock_nanosleep64."); - return errno; - } + if (ret) + return -errno; + next.tv_sec = ts1.tv_sec + interval; next.tv_nsec = ts1.tv_nsec; - ret = syscall(code, CLOCK_MONOTONIC, TIMER_ABSTIME, + ret = XENOMAI_SYSCALL4(code, CLOCK_MONOTONIC, TIMER_ABSTIME, &next, (void *)0xdeadbeefUL); if (!smokey_assert(!ret)) - return errno; + return ret ? ret : -EINVAL; ret = clock_gettime(CLOCK_MONOTONIC, &ts2); - if (ret) { - smokey_warning("clock_gettime failed in clock_nanosleep64."); - return errno; - } + if (ret) + return -errno; timespec_sub(&delta, &ts2, &ts1); if (delta.tv_sec < interval)@@ -450,15 +439,13 @@ static int test_sc_cobalt_clock_nanosleep64(void) next.tv_sec = ts2.tv_sec + interval; next.tv_nsec = ts2.tv_nsec; - ret = syscall(code, CLOCK_MONOTONIC, TIMER_ABSTIME, &next, &rmt); + ret = XENOMAI_SYSCALL4(code, CLOCK_MONOTONIC, TIMER_ABSTIME, &next, &rmt); if (!smokey_assert(!ret)) - return errno; + return ret ? ret : -EINVAL; ret = clock_gettime(CLOCK_MONOTONIC, &ts1); - if (ret) { - smokey_warning("clock_gettime failed in clock_nanosleep64."); - return errno; - } + if (ret) + return -errno; timespec_sub(&delta, &ts1, &ts2); if (delta.tv_sec < interval)@@ -474,23 +461,22 @@ static int test_sc_cobalt_clock_getres64(void) struct xn_timespec64 ts64; /* Make sure we don't crash because of NULL pointers */ - ret = syscall(code, NULL, NULL); - if (ret == -1 && errno == ENOSYS) { + ret = XENOMAI_SYSCALL2(code, NULL, NULL); + if (ret == -ENOSYS) { smokey_note("clock_getres64: skipped. (no kernel support)"); return 0; // Not implemented, nothing to test, success } - if (!smokey_assert(ret == -1) || !smokey_assert(errno == EFAULT)) - return errno; /* Providing an invalid address has to deliver EFAULT */ - ret = syscall(code, CLOCK_MONOTONIC, (void *)0xdeadbeefUL); - if (!smokey_assert(ret == -1) || !smokey_assert(errno == EFAULT)) - return errno; + ret = XENOMAI_SYSCALL2(code, CLOCK_MONOTONIC, (void *)0xdeadbeefUL ); + if (!smokey_assert(ret)) + return ret ? ret : -EINVAL; /* Provide a valid 64bit timespec*/ - ret = syscall(code, CLOCK_MONOTONIC, &ts64); + ret = XENOMAI_SYSCALL2(code, CLOCK_MONOTONIC, &ts64); if (!smokey_assert(!ret)) - return errno; + return ret ? ret : -EINVAL; + if (ts64.tv_sec != 0 || ts64.tv_nsec != 1) smokey_warning("High resolution timers not available\n"); @@ -504,25 +490,23 @@ static int test_sc_cobalt_clock_adjtime64(void) struct xn_timex64 tx64 = {}; /* Make sure we don't crash because of NULL pointers */ - ret = syscall(code, NULL, NULL); - if (ret == -1 && errno == ENOSYS) { + ret = XENOMAI_SYSCALL2(code, NULL, NULL); + if (ret == -ENOSYS) { smokey_note("clock_adjtime64: skipped. (no kernel support)"); return 0; // Not implemented, nothing to test, success } - if (!smokey_assert(ret == -1) || !smokey_assert(errno == EFAULT)) - return errno; /* Providing an invalid address has to deliver EFAULT */ - ret = syscall(code, CLOCK_REALTIME, (void *)0xdeadbeefUL); - if (!smokey_assert(ret == -1) || !smokey_assert(errno == EFAULT)) - return errno; + ret = XENOMAI_SYSCALL2(code, CLOCK_REALTIME, (void *)0xdeadbeefUL); + if (!smokey_assert(ret)) + return ret ? ret : -EINVAL; /* Provide a valid 64bit timex*/testsuite/smokey/y2038/syscall-tests.c static int test_sc_cobalt_clock_getres64(void) · line 512
Quoted 10 lines
testsuite/smokey/y2038/syscall-tests.c +3
-3tx64.modes = ADJ_SETOFFSET; tx64.time.tv_usec = 123; - ret = syscall(code, CLOCK_REALTIME, &tx64); - if (!smokey_assert(!ret)) - return errno; + ret = XENOMAI_SYSCALL2(code, CLOCK_REALTIME, &tx64); + if (!smokey_assert(ret)) + return ret ? ret : -EINVAL; return 0; }What is the baseline of this? It seems to be an unmerged patch, thus you
Quoted 8 lines
Quoted 6 lines
yes, you are right, it's based on my unmerged patches, Florian will merge them on [1] soon and this is the last one.
baseline is [1], branch: florian/y2038. [1]:[email protected]:Xenomai/xenomai-hacker-space.git
Ah, ok - tagging the patches would help, e.g. "[florian/y2038][PATCH] ...".
ok, will do in next patches.
Quoted 12 lines
Jan
Quoted 7 lines
Song
Quoted 5 lines
rather want to send out a new version of that other patch, including this fix.
Jan