1 #include "tests.h"
2 #include <asm/unistd.h>
3 
4 #ifdef __NR_sched_rr_get_interval
5 
6 # include <stdint.h>
7 # include <stdio.h>
8 # include <sched.h>
9 # include <unistd.h>
10 
11 int
12 main(void)
13 {
14 	TAIL_ALLOC_OBJECT_CONST_PTR(struct timespec, tp);
15 	long rc;
16 
17 	rc = syscall(__NR_sched_rr_get_interval, 0, NULL);
18 	printf("sched_rr_get_interval(0, NULL) = %s\n", sprintrc(rc));
19 
20 	rc = syscall(__NR_sched_rr_get_interval, 0, tp + 1);
21 	printf("sched_rr_get_interval(0, %p) = %s\n", tp + 1, sprintrc(rc));
22 
23 	rc = syscall(__NR_sched_rr_get_interval, -1, tp);
24 	printf("sched_rr_get_interval(-1, %p) = %s\n", tp, sprintrc(rc));
25 
26 	rc = syscall(__NR_sched_rr_get_interval, 0, tp);
27 	if (rc == 0)
28 		printf("sched_rr_get_interval(0, {tv_sec=%lld, tv_nsec=%llu})"
29 		       " = 0\n",
30 		       (long long) tp->tv_sec,
31 		       zero_extend_signed_to_ull(tp->tv_nsec));
32 	else
33 		printf("sched_rr_get_interval(-1, %p) = %s\n", tp,
34 			sprintrc(rc));
35 
36 	puts("+++ exited with 0 +++");
37 	return 0;
38 }
39 
40 #else
41 
42 SKIP_MAIN_UNDEFINED("__NR_sched_rr_get_interval")
43 
44 #endif
45