Debian Codegraph @

testsuite/systemtap.syscall/timer.c

raw
1 /* COVERAGE: timer_create timer_gettime timer_settime timer_getoverrun timer_delete */
2 #include <sys/types.h>
3 #include <unistd.h>
4 #include <sys/time.h>
5 #include <string.h>
6 #include <signal.h>
7 #include <time.h>
8 #include <sys/syscall.h>
9
10 int main()
11 {
12 timer_t tid=0;
13 struct itimerspec val, oval;
14
15
16 // SYSCALL timer_create -----
17
18 syscall(__NR_timer_create, -1, NULL, &tid);
19 //staptest// timer_create (0x[f]+, 0x0, XXXX) = NNNN (EINVAL)
20
21 syscall(__NR_timer_create, CLOCK_REALTIME, -1, &tid);
22 #ifdef __s390__
23 //staptest// timer_create (CLOCK_REALTIME, 0x[7]?[f]+, XXXX) = NNNN (EFAULT)
24 #else
25 //staptest// timer_create (CLOCK_REALTIME, 0x[f]+, XXXX) = NNNN (EFAULT)
26 #endif
27
28 syscall(__NR_timer_create, CLOCK_REALTIME, NULL, -1);
29 #ifdef __s390__
30 //staptest// timer_create (CLOCK_REALTIME, 0x0, 0x[7]?[f]+) = NNNN (EFAULT)
31 #else
32 //staptest// timer_create (CLOCK_REALTIME, 0x0, 0x[f]+) = NNNN (EFAULT)
33 #endif
34
35 timer_create(CLOCK_REALTIME, NULL, &tid);
36 //staptest// timer_create (CLOCK_REALTIME, XXXX, XXXX) = 0
37
38
39 // SYSCALL timer_gettime -----
40
41 syscall(__NR_timer_gettime, -1, &val);
42 //staptest// timer_gettime (-1, XXXX) = NNNN (EINVAL)
43
44 syscall(__NR_timer_gettime, tid, -1);
45 #ifdef __s390__
46 //staptest// timer_gettime (NNNN, 0x[7]?[f]+) = NNNN ([[[[EINVAL!!!!EFAULT]]]])
47 #else
48 //staptest// timer_gettime (NNNN, 0x[f]+) = NNNN ([[[[EINVAL!!!!EFAULT]]]])
49 #endif
50
51 timer_gettime(tid, &val);
52 //staptest// timer_gettime (NNNN, XXXX) = 0
53
54
55 // SYSCALL timer_settime -----
56
57 val.it_value.tv_sec = 0;
58 val.it_value.tv_nsec = 0;
59 val.it_interval.tv_sec = 0;
60 val.it_interval.tv_nsec = 0;
61
62 syscall(__NR_timer_settime, -1, 0, &val, &oval);
63 //staptest// timer_settime (-1, 0, \[0.000000,0.000000\], XXXX) = NNNN (EINVAL)
64
65 syscall(__NR_timer_settime, 0, -1, &val, &oval);
66 //staptest// timer_settime (0, -1, \[0.000000,0.000000\], XXXX) = NNNN
67
68 syscall(__NR_timer_settime, tid, 0, -1, &oval);
69 #ifdef __s390__
70 //staptest// timer_settime (NNNN, 0, 0x[7]?[f]+, XXXX) = NNNN (EFAULT)
71 #else
72 //staptest// timer_settime (NNNN, 0, 0x[f]+, XXXX) = NNNN (EFAULT)
73 #endif
74
75 syscall(__NR_timer_settime, tid, 0, &val, -1);
76 #ifdef __s390__
77 //staptest// timer_settime (NNNN, 0, \[0.000000,0.000000\], 0x[7]?[f]+) = NNNN ([[[[EINVAL!!!!EFAULT]]]])
78 #else
79 //staptest// timer_settime (NNNN, 0, \[0.000000,0.000000\], 0x[f]+) = NNNN ([[[[EINVAL!!!!EFAULT]]]])
80 #endif
81
82 timer_settime(tid, -1, &val, &oval);
83 //staptest// timer_settime (NNNN, -1, \[0.000000,0.000000\], XXXX) = 0
84
85
86 // SYSCALL timer_getoverrun -----
87
88 syscall(__NR_timer_getoverrun, -1);
89 //staptest// timer_getoverrun (-1) = NNNN (EINVAL)
90
91 timer_getoverrun(tid);
92 //staptest// timer_getoverrun (NNNN) = 0
93
94
95 // SYSCALL timer_delete -----
96
97 syscall(__NR_timer_delete, -1);
98 //staptest// timer_delete (-1) = NNNN (EINVAL)
99
100 timer_delete(tid);
101 //staptest// timer_delete (NNNN) = 0
102
103 return 0;
104 }
105