strace/tests/epoll_ctl.c
Dmitry V. Levin 18b582ec11 tests: replace casts of 0xffffffff00000000ULL with F8ILL_KULONG_MASK
* tests/init_delete_module.h (bogus_zero): Remove.
* tests/delete_module.c (main): Replace bogus_zero and
(kernel_ulong_t) 0xffffffff00000000ULL with F8ILL_KULONG_MASK.
* tests/finit_module.c (main): Replace bogus_zero
with F8ILL_KULONG_MASK.
* tests/init_module.c (main): Likewise.
* tests/pipe2.c (main): Likewise.
* tests/epoll_ctl.c (invoke_syscall): Replace
(unsigned long) 0xffffffff00000000ULL with F8ILL_KULONG_MASK.
* tests/rt_tgsigqueueinfo.c (k_tgsigqueueinfo): Likewise.
* tests/fanotify_init.c (main): Likewise.
* tests/xetpgid.c (main): Likewise.
* tests/xetpriority.c (main): Likewise.
(kernel_ulong_t) 0xffffffff00000000ULL with F8ILL_KULONG_MASK.
* tests/fanotify_mark.c (main): Likewise.
* tests/file_handle.c (main): Likewise.
* tests/kexec_load.c (main): Likewise.
* tests/setfsugid.c (main): Likewise.
* tests/getgroups.c (main): Replace (long) 0xffffffff00000000ULL
with F8ILL_KULONG_MASK.
* tests/setgroups.c (main): Replace (long) 0xffffffff00000000ULL
and (unsigned long) 0xffffffff00000000ULL with F8ILL_KULONG_MASK.
2017-02-16 16:36:14 +00:00

46 lines
1.0 KiB
C

#include "tests.h"
#include <asm/unistd.h>
#ifdef __NR_epoll_ctl
# include <inttypes.h>
# include <stdio.h>
# include <sys/epoll.h>
# include <unistd.h>
static long
invoke_syscall(unsigned long epfd, unsigned long op, unsigned long fd, void *ev)
{
return syscall(__NR_epoll_ctl, epfd, F8ILL_KULONG_MASK | op,
fd, (unsigned long) ev);
}
int
main(void)
{
struct epoll_event *const ev = tail_alloc(sizeof(*ev));
ev->events = EPOLLIN;
long rc = invoke_syscall(-1U, EPOLL_CTL_ADD, -2U, ev);
printf("epoll_ctl(-1, EPOLL_CTL_ADD, -2, {EPOLLIN,"
" {u32=%u, u64=%" PRIu64 "}}) = %ld %s (%m)\n",
ev->data.u32, ev->data.u64, rc, errno2name());
rc = invoke_syscall(-3U, EPOLL_CTL_DEL, -4U, ev);
printf("epoll_ctl(-3, EPOLL_CTL_DEL, -4, %p) = %ld %s (%m)\n",
ev, rc, errno2name());
rc = invoke_syscall(-1UL, EPOLL_CTL_MOD, -16UL, 0);
printf("epoll_ctl(-1, EPOLL_CTL_MOD, -16, NULL) = %ld %s (%m)\n",
rc, errno2name());
puts("+++ exited with 0 +++");
return 0;
}
#else
SKIP_MAIN_UNDEFINED("__NR_epoll_ctl")
#endif