summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorgjb <gjb@FreeBSD.org>2016-02-22 12:28:23 +0000
committergjb <gjb@FreeBSD.org>2016-02-22 12:28:23 +0000
commit8bfb527a82b3844c875182139d053826902f90d6 (patch)
tree8a0600337b49dbed7acd411e862bbcfba916c0bc /tests
parentadbdbd2fff21519f0d418a20255dfd18a2381dbc (diff)
parent6a7ac9da7c8a3a5b9c0a21830670b06935f58332 (diff)
downloadFreeBSD-src-8bfb527a82b3844c875182139d053826902f90d6.zip
FreeBSD-src-8bfb527a82b3844c875182139d053826902f90d6.tar.gz
MFH
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'tests')
-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 cc65427..2837144 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 */
OpenPOWER on IntegriCloud