Skip to content

Commit

Permalink
add kqueue1 support for OpenBSD, fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jiixyj committed Jun 8, 2024
1 parent 3139d76 commit 1dab888
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ include(CheckSymbolExists)
check_symbol_exists(eventfd "sys/eventfd.h" HAVE_EVENTFD)
check_symbol_exists(timerfd_create "sys/timerfd.h" HAVE_TIMERFD)

check_symbol_exists(kqueue1 "sys/event.h;sys/time.h" HAVE_KQUEUE1)
check_symbol_exists(kqueue1 "sys/types.h;sys/event.h;sys/time.h" HAVE_KQUEUE1)
add_compat_target(kqueue1 "NOT;HAVE_KQUEUE1")
check_symbol_exists(sigandset "signal.h" HAVE_SIGANDSET)
check_symbol_exists(sigorset "signal.h" HAVE_SIGORSET)
Expand Down
10 changes: 5 additions & 5 deletions test/pipe-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1272,15 +1272,15 @@ ATF_TC_BODY_FD_LEAKCHECK(pipe__closed_read_end, tc)
#elif defined(__APPLE__)
ATF_REQUIRE(kev[1].data == 0);
atf_tc_skip("This doesn't work on macOS");
#elif defined(__DragonFly__)
#elif defined(__DragonFly__) || defined(__OpenBSD__)
ATF_REQUIRE(kev[1].data == 0);
#else
ATF_REQUIRE(kev[1].data == EPIPE);
ATF_REQUIRE_MSG(kev[1].data == EPIPE, "kev[1].data: %d", (int)kev[1].data);
#endif

ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev),
&(struct timespec) { 0, 0 }) ==
#if defined(__DragonFly__)
#if defined(__DragonFly__) || defined(__OpenBSD__)
2
#else
1
Expand Down Expand Up @@ -1608,15 +1608,15 @@ ATF_TC_BODY_FD_LEAKCHECK(pipe__closed_write_end, tc)
#elif defined(__APPLE__)
ATF_REQUIRE(kev[1].data == 0);
atf_tc_skip("This doesn't work on macOS");
#elif defined(__DragonFly__)
#elif defined(__DragonFly__) || defined(__OpenBSD__)
ATF_REQUIRE(kev[1].data == 0);
#else
ATF_REQUIRE(kev[1].data == EPIPE);
#endif

ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev),
&(struct timespec) { 0, 0 }) ==
#if defined(__DragonFly__)
#if defined(__DragonFly__) || defined(__OpenBSD__)
2
#else
1
Expand Down
5 changes: 3 additions & 2 deletions test/timerfd-mock-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ ATF_TC_BODY(timerfd_mock__mocked_kevent, tc)
ATF_REQUIRE(kevent_called == 1 || kevent_called == 2);

#ifndef __linux__
#if defined(__FreeBSD__) || \
(defined(__NetBSD__) && __NetBSD_Version__ >= 999009100)
#if defined(__FreeBSD__) || \
(defined(__NetBSD__) && __NetBSD_Version__ >= 999009100) || \
defined(__OpenBSD__)
if (evfilt_timer_fflags == 0) {
ATF_REQUIRE(evfilt_timer_data == ms);
} else {
Expand Down

0 comments on commit 1dab888

Please sign in to comment.