aboutsummaryrefslogtreecommitdiff
path: root/tests/sys/kqueue
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2016-02-19 01:49:33 +0000
committerMark Johnston <markj@FreeBSD.org>2016-02-19 01:49:33 +0000
commit88c2beac9cedc0bd3ef6696833ea4d8d6f59faa1 (patch)
treeef3f31cabf603feda666420b4028149bee55f1ae /tests/sys/kqueue
parentfe169828c3d6b0dfabd753da476928fe23ab54a5 (diff)
Notes
Diffstat (limited to 'tests/sys/kqueue')
-rw-r--r--tests/sys/kqueue/read.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/sys/kqueue/read.c b/tests/sys/kqueue/read.c
index cc6542719fba..28371444383f 100644
--- a/tests/sys/kqueue/read.c
+++ b/tests/sys/kqueue/read.c
@@ -124,15 +124,17 @@ test_kevent_socket_disable_and_enable(void)
test_begin(test_id);
- /* Add an event, then disable it. */
- EV_SET(&kev, sockfd[0], EVFILT_READ, EV_ADD, 0, 0, &sockfd[0]);
- if (kevent(kqfd, &kev, 1, NULL, 0, NULL) < 0)
- err(1, "%s", test_id);
- EV_SET(&kev, sockfd[0], EVFILT_READ, EV_DISABLE, 0, 0, &sockfd[0]);
+ /*
+ * Write to the socket before adding the event. This way we can verify that
+ * enabling a triggered kevent causes the event to be returned immediately.
+ */
+ kevent_socket_fill();
+
+ /* Add a disabled event. */
+ EV_SET(&kev, sockfd[0], EVFILT_READ, EV_ADD | EV_DISABLE, 0, 0, &sockfd[0]);
if (kevent(kqfd, &kev, 1, NULL, 0, NULL) < 0)
err(1, "%s", test_id);
- kevent_socket_fill();
test_no_kevents();
/* Re-enable the knote, then see if an event is generated */