]> granicus.if.org Git - strace/blob - tests/sched_rr_get_interval.c
Replace "(unsigned long) -1L" with -1UL
[strace] / tests / sched_rr_get_interval.c
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         struct timespec *const tp = tail_alloc(sizeof(struct timespec));
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=%jd, tv_nsec=%jd}) = "
29                        "0\n", (intmax_t)tp->tv_sec, (intmax_t)tp->tv_nsec);
30         else
31                 printf("sched_rr_get_interval(-1, %p) = %s\n", tp,
32                         sprintrc(rc));
33
34         puts("+++ exited with 0 +++");
35         return 0;
36 }
37
38 #else
39
40 SKIP_MAIN_UNDEFINED("__NR_sched_rr_get_interval")
41
42 #endif