]> sourceware.org Git - systemtap.git/blob - testsuite/systemtap.syscall/poll.c
The 32-bit arm does not remap epoll_wait or poll syscalls
[systemtap.git] / testsuite / systemtap.syscall / poll.c
1 /* COVERAGE: epoll_create epoll_ctl epoll_wait epoll_pwait poll ppoll */
2 #define _GNU_SOURCE
3 #include <stdio.h>
4 #include <sys/epoll.h>
5 #include <poll.h>
6 #include <signal.h>
7 #include <sys/syscall.h>
8
9
10 #ifdef SYS_epoll_pwait
11 int __epoll_pwait(int epfd, struct epoll_event *events,
12 int maxevents, int timeout,
13 const sigset_t *set)
14 {
15 return syscall(__NR_epoll_pwait, epfd, events, maxevents, timeout,
16 set, _NSIG / 8);
17 }
18 #endif
19
20 int main()
21 {
22 struct epoll_event ev, events[17];
23 struct pollfd pfd = {7, 0x23, 0};
24 int fd;
25 struct timespec tim = {.tv_sec=0, .tv_nsec=200000000};
26 sigset_t sigs;
27
28 sigemptyset(&sigs);
29 sigaddset(&sigs,SIGUSR2);
30
31 #ifdef EPOLL_CLOEXEC
32 fd = epoll_create1(EPOLL_CLOEXEC);
33 //staptest// epoll_create1 (EPOLL_CLOEXEC) = NNNN
34
35 epoll_create1(-1);
36 //staptest// epoll_create1 (EPOLL_CLOEXEC|0xfff7ffff) = -NNNN (EINVAL)
37 #else
38 fd = epoll_create(32);
39 //staptest// epoll_create (32) = NNNN
40
41 epoll_create(-1);
42 //staptest// epoll_create (-1) = -NNNN (EINVAL)
43 #endif
44
45 epoll_ctl(fd, EPOLL_CTL_ADD, 13, &ev);
46 //staptest// epoll_ctl (NNNN, EPOLL_CTL_ADD, 13, XXXX) = -NNNN (EBADF)
47
48 epoll_ctl(-1, EPOLL_CTL_ADD, 13, &ev);
49 //staptest// epoll_ctl (-1, EPOLL_CTL_ADD, 13, XXXX) = -NNNN (EBADF)
50
51 epoll_ctl(fd, -1, 13, &ev);
52 //staptest// epoll_ctl (NNNN, 0xffffffff, 13, XXXX) = -NNNN (EBADF)
53
54 epoll_ctl(fd, EPOLL_CTL_ADD, -1, &ev);
55 //staptest// epoll_ctl (NNNN, EPOLL_CTL_ADD, -1, XXXX) = -NNNN (EBADF)
56
57 epoll_ctl(fd, EPOLL_CTL_ADD, 13, (struct epoll_event *)-1);
58 #ifdef __s390__
59 //staptest// epoll_ctl (NNNN, EPOLL_CTL_ADD, 13, 0x[7]?[f]+) = -NNNN (EFAULT)
60 #else
61 //staptest// epoll_ctl (NNNN, EPOLL_CTL_ADD, 13, 0x[f]+) = -NNNN (EFAULT)
62 #endif
63
64 epoll_wait(fd, events, 17, 0);
65 #if defined(__aarch64__)
66 //staptest// epoll_pwait (NNNN, XXXX, 17, 0, XXXX, NNNN) = 0
67 #else
68 //staptest// epoll_wait (NNNN, XXXX, 17, 0) = 0
69 #endif
70
71 epoll_wait(-1, events, 17, 0);
72 #if defined(__aarch64__)
73 //staptest// epoll_pwait (-1, XXXX, 17, 0, XXXX, NNNN) = -NNNN (EBADF)
74 #else
75 //staptest// epoll_wait (-1, XXXX, 17, 0) = -NNNN (EBADF)
76 #endif
77
78 epoll_wait(fd, (struct epoll_event *)-1, 17, 0);
79 #ifdef __s390__
80 //staptest// epoll_wait (NNNN, 0x[7]?[f]+, 17, 0) =
81 #elif defined(__aarch64__)
82 //staptest// epoll_pwait (NNNN, 0x[f]+, 17, 0, XXXX, NNNN) = NNNN
83 #else
84 //staptest// epoll_wait (NNNN, 0x[f]+, 17, 0) =
85 #endif
86
87 epoll_wait(fd, events, -1, 0);
88 #if defined(__aarch64__)
89 //staptest// epoll_pwait (NNNN, XXXX, -1, 0, XXXX, NNNN) = NNNN (EINVAL)
90 #else
91 //staptest// epoll_wait (NNNN, XXXX, -1, 0) = -NNNN (EINVAL)
92 #endif
93
94 epoll_wait(-1, events, 17, -1);
95 #if defined(__aarch64__)
96 //staptest// epoll_pwait (-1, XXXX, 17, -1, XXXX, NNNN) = NNNN (EBADF)
97 #else
98 //staptest// epoll_wait (-1, XXXX, 17, -1) = -NNNN (EBADF)
99 #endif
100
101 // RHEL5 x86_64 defines SYS_epoll_pwait, but doesn't have epoll_pwait()
102 #ifdef SYS_epoll_pwait
103 __epoll_pwait(fd, events, 17, 0, NULL);
104 //staptest// [[[[epoll_pwait (NNNN, XXXX, 17, 0, 0x0, NNNN) = 0!!!!ni_syscall () = -38 (ENOSYS)]]]]
105
106 __epoll_pwait(fd, events, 17, 0, &sigs);
107 //staptest// [[[[epoll_pwait (NNNN, XXXX, 17, 0, XXXX, NNNN) = 0!!!!ni_syscall () = -38 (ENOSYS)]]]]
108
109 __epoll_pwait(-1, events, 17, 0, &sigs);
110 //staptest// [[[[epoll_pwait (-1, XXXX, 17, 0, XXXX, NNNN) = -NNNN (EBADF)!!!!ni_syscall () = -38 (ENOSYS)]]]]
111
112 __epoll_pwait(fd, (struct epoll_event *)-1, 17, 0, &sigs);
113 #ifdef __s390__
114 //staptest// epoll_pwait (NNNN, 0x[7]?[f]+, 17, 0, XXXX, NNNN) =
115 #else
116 //staptest// [[[[epoll_pwait (NNNN, 0x[f]+, 17, 0, XXXX, NNNN) =!!!!ni_syscall () = -38 (ENOSYS)]]]]
117 #endif
118
119 __epoll_pwait(fd, events, -1, 0, &sigs);
120 //staptest// [[[[epoll_pwait (NNNN, XXXX, -1, 0, XXXX, NNNN) = -NNNN (EINVAL)!!!!ni_syscall () = -38 (ENOSYS)]]]]
121
122 __epoll_pwait(-1, events, 17, -1, &sigs);
123 //staptest// [[[[epoll_pwait (-1, XXXX, 17, -1, XXXX, NNNN) = -NNNN (EBADF)!!!!ni_syscall () = -38 (ENOSYS)]]]]
124
125 __epoll_pwait(fd, events, 17, 0, (sigset_t *)-1);
126 #ifdef __s390__
127 //staptest// epoll_pwait (NNNN, XXXX, 17, 0, 0x[7]?[f]+, NNNN) = -NNNN (EFAULT)
128 #else
129 //staptest// [[[[epoll_pwait (NNNN, XXXX, 17, 0, 0x[f]+, NNNN) = -NNNN (EFAULT)!!!!ni_syscall () = -38 (ENOSYS)]]]]
130 #endif
131 #endif
132
133 close(fd);
134 //staptest// close (NNNN) = 0
135
136 poll(&pfd, 1, 0);
137 #if defined(__aarch64__)
138 //staptest// ppoll (XXXX, 1, \[0.000000000\], XXXX, NNNN) = NNNN
139 #else
140 //staptest// poll (XXXX, 1, 0) = NNNN
141 #endif
142
143 poll((struct pollfd *)-1, 1, 0);
144 #ifdef __s390__
145 //staptest// poll (0x[7]?[f]+, 1, 0) = -NNNN (EFAULT)
146 #elif defined(__aarch64__)
147 //staptest// ppoll (0x[f]+, 1, \[0.000000000\], XXXX, NNNN) = -NNNN (EFAULT)
148 #else
149 //staptest// poll (0x[f]+, 1, 0) = -NNNN (EFAULT)
150 #endif
151
152 poll(&pfd, -1, 0);
153 #if defined(__aarch64__)
154 //staptest// ppoll (XXXX, 4294967295, \[0.000000000\], XXXX, NNNN) = -NNNN (EINVAL)
155 #else
156 //staptest// poll (XXXX, 4294967295, 0) = -NNNN (EINVAL)
157 #endif
158
159 // A timetout value of -1 means an infinite timeout. So, we'll also
160 // send a NULL pollfd structure pointer.
161 poll(NULL, 1, -1);
162 #if defined(__aarch64__)
163 //staptest// ppoll (0x0, 1, NULL, XXXX, NNNN) = -NNNN (EFAULT)
164 #else
165 //staptest// poll (0x0, 1, -1) = -NNNN (EFAULT)
166 #endif
167
168 #ifdef SYS_ppoll
169 ppoll(&pfd, 1, &tim, &sigs);
170 //staptest// ppoll (XXXX, 1, \[0.200000000\], XXXX, 8) = NNNN
171
172 ppoll((struct pollfd *)-1, 1, &tim, &sigs);
173 #ifdef __s390__
174 //staptest// ppoll (0x[7]?[f]+, 1, \[0.200000000\], XXXX, 8) = -NNNN (EFAULT)
175 #else
176 //staptest// ppoll (0x[f]+, 1, \[0.200000000\], XXXX, 8) = -NNNN (EFAULT)
177 #endif
178
179 ppoll(&pfd, -1, &tim, &sigs);
180 //staptest// ppoll (XXXX, 4294967295, \[0.200000000\], XXXX, 8) = -NNNN (EINVAL)
181
182 // Specifying a timespec pointer of -1 will crash the test
183 // executable, so we'll have to skip it.
184 //ppoll((struct pollfd *)-1, 1, (struct timespec *)-1, &sigs);
185
186 ppoll(&pfd, 1, &tim, (sigset_t *)-1);
187 #ifdef __s390__
188 //staptest// ppoll (XXXX, 1, \[0.200000000\], 0x[7]?[f]+, 8) = -NNNN (EFAULT)
189 #else
190 //staptest// ppoll (XXXX, 1, \[0.200000000\], 0x[f]+, 8) = -NNNN (EFAULT)
191 #endif
192 #endif
193
194 return 0;
195 }
This page took 0.045721 seconds and 5 git commands to generate.