9c8ec0a80f
Negative micro/nanoseconds values are treated as invalid by kernel anyway, and in one case (timespec_valid in include/linux/time.h) it is even checked by conversion to unsigned long. * print_timespec.c (timespec_fmt): Change tv_sec format to %lld and tv_nsec format to %llu. (print_timespec_t): Cast tv_sec to long long and process tv_nsec with zero_extend_signed_to_ull. (sprint_timespec): Likewise. * print_timeval.c (timeval_fmt): Change tv_sec format to %lld and tv_usec format to %llu. (print_timeval_t): Cast tv_sec to long long and process tv_nsec with zero_extend_signed_to_ull. (sprint_timeval, print_timeval32_t, sprint_timeval32): Likewise. * defs.h (TIMESPEC_TEXT_BUFSIZE): Update. * tests/adjtimex.c (main): Change tv_sec printing format to %lld, cast it to long long; change tv_usec printing format to %llu, process it with zero_extend_signed_to_ull. * tests/clock_nanosleep.c (main): Change tv_sec printing format to %lld, cast it to long long; change tv_nsec printing format to %llu, process it with zero_extend_signed_to_ull. * tests/clock_xettime.c (main): Likewise. * tests/futex.c (main): Likewise. * tests/futimesat.c (print_tv): Likewise. * tests/getrusage.c (invoke_print): Likewise. * tests/mq_sendrecv.c (do_send, do_recv, main): Likewise. * tests/nanosleep.c (main): Likewise. * tests/pselect6.c (main): Likewise. * tests/restart_syscall.c (main): Likewise. * tests/rt_sigtimedwait.c (iterate, main): Likewise. * tests/sched_rr_get_interval.c (main): Likewise. * tests/semop.c (main): Likewise. * tests/timer_xettime.c (main): Likewise. * tests/timerfd_xettime.c (main): Likewise. * tests/waitid.c (main): Likewise. * tests/xetitimer.c (main): Likewise. * tests/xettimeofday.c (main): Likewise. * tests/xselect.c (main): Likewise. * tests/xutimes.c (print_tv): Likewise. * tests/wait4.c (sprint_rusage): Likewise. * tests/waitid.c (sprint_rusage): Likewise. * tests/utimensat.c (print_ts): Likewise. (main): Add check for higher bits of tv_sec/tv_nsec. Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
45 lines
1022 B
C
45 lines
1022 B
C
#include "tests.h"
|
|
#include <asm/unistd.h>
|
|
|
|
#ifdef __NR_sched_rr_get_interval
|
|
|
|
# include <stdint.h>
|
|
# include <stdio.h>
|
|
# include <sched.h>
|
|
# include <unistd.h>
|
|
|
|
int
|
|
main(void)
|
|
{
|
|
TAIL_ALLOC_OBJECT_CONST_PTR(struct timespec, tp);
|
|
long rc;
|
|
|
|
rc = syscall(__NR_sched_rr_get_interval, 0, NULL);
|
|
printf("sched_rr_get_interval(0, NULL) = %s\n", sprintrc(rc));
|
|
|
|
rc = syscall(__NR_sched_rr_get_interval, 0, tp + 1);
|
|
printf("sched_rr_get_interval(0, %p) = %s\n", tp + 1, sprintrc(rc));
|
|
|
|
rc = syscall(__NR_sched_rr_get_interval, -1, tp);
|
|
printf("sched_rr_get_interval(-1, %p) = %s\n", tp, sprintrc(rc));
|
|
|
|
rc = syscall(__NR_sched_rr_get_interval, 0, tp);
|
|
if (rc == 0)
|
|
printf("sched_rr_get_interval(0, {tv_sec=%lld, tv_nsec=%llu})"
|
|
" = 0\n",
|
|
(long long) tp->tv_sec,
|
|
zero_extend_signed_to_ull(tp->tv_nsec));
|
|
else
|
|
printf("sched_rr_get_interval(-1, %p) = %s\n", tp,
|
|
sprintrc(rc));
|
|
|
|
puts("+++ exited with 0 +++");
|
|
return 0;
|
|
}
|
|
|
|
#else
|
|
|
|
SKIP_MAIN_UNDEFINED("__NR_sched_rr_get_interval")
|
|
|
|
#endif
|