Commit 5028f71c authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

zdtm: Extend eventfs test for epolls

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent b38777df
...@@ -33,17 +33,38 @@ const char *test_author = "Cyrill Gorcunov <gorcunov@openvz.org>"; ...@@ -33,17 +33,38 @@ const char *test_author = "Cyrill Gorcunov <gorcunov@openvz.org>";
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int efd, ret; int efd, ret, epollfd;
int pipefd[2];
uint64_t v = EVENTFD_INITIAL; uint64_t v = EVENTFD_INITIAL;
struct epoll_event ev;
test_init(argc, argv); test_init(argc, argv);
if (pipe(pipefd)) {
fail("pipe");
exit(1);
}
epollfd = epoll_create(1);
if (epollfd < 0) {
fail("epoll_create");
exit(1);
}
efd = eventfd((unsigned int)v, EFD_NONBLOCK); efd = eventfd((unsigned int)v, EFD_NONBLOCK);
if (efd < 0) { if (efd < 0) {
fail("eventfd"); fail("eventfd");
exit(1); exit(1);
} }
memset(&ev, 0xff, sizeof(ev));
ev.events = EPOLLIN | EPOLLOUT;
if (epoll_ctl(epollfd, EPOLL_CTL_ADD, pipefd[0], &ev)) {
fail("epoll_ctl");
exit(1);
}
test_msg("created eventfd with %lx\n", v); test_msg("created eventfd with %lx\n", v);
ret = write(efd, &v, sizeof(v)); ret = write(efd, &v, sizeof(v));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment