Skip to content

Commit 7ca0a63

Browse files
authored
Merge pull request #224 from dgrove-oss/epoll_support_dispatch_test
SR-4026: dispatch_test_check_evfilt_read_for_fd for epoll
2 parents b6f8908 + ee8143e commit 7ca0a63

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

tests/dispatch_test.c

+12-2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
#if __has_include(<sys/event.h>)
3232
#define HAS_SYS_EVENT_H 1
3333
#include <sys/event.h>
34+
#else
35+
#include <sys/poll.h>
3436
#endif
3537
#include <assert.h>
3638

@@ -65,8 +67,16 @@ dispatch_test_check_evfilt_read_for_fd(int fd)
6567
close(kq);
6668
return r > 0;
6769
#else
68-
// TODO: Need to write a real check for epoll-backend here
69-
return true;
70+
struct pollfd pfd = {
71+
.fd = fd,
72+
.events = POLLIN,
73+
};
74+
int rc;
75+
do {
76+
rc = poll(&pfd, 1, 0);
77+
} while (rc == -1 && errno == EINTR);
78+
assert(rc != -1);
79+
return rc == 1;
7080
#endif
7181
}
7282

0 commit comments

Comments
 (0)