Skip to content

Commit de3b12c

Browse files
charlesrocketnikneym
authored andcommitted
Fix FreeBSD support
1 parent 6a357d1 commit de3b12c

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/backend/kqueue.zig

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const log = std.log.scoped(.libxev_kqueue);
1717
/// True if this backend is available on this platform.
1818
pub fn available() bool {
1919
return switch (builtin.os.tag) {
20-
.ios, .macos => true,
20+
.freebsd, .ios, .macos => true,
2121

2222
// Technically other BSDs support kqueue but our implementation
2323
// below hard requires mach ports currently. That's not a fundamental
@@ -27,9 +27,9 @@ pub fn available() bool {
2727
};
2828
}
2929

30-
const NOTE_EXIT_FLAGS = switch (builtin.os.tag) {
31-
.ios, .macos => posix.system.NOTE_EXIT | posix.system.NOTE_EXITSTATUS,
32-
.freebsd => posix.system.NOTE_EXIT,
30+
pub const NOTE_EXIT_FLAGS = switch (builtin.os.tag) {
31+
.ios, .macos, => std.c.NOTE.EXIT | std.c.NOTE.EXITSTATUS,
32+
.freebsd => std.c.NOTE.EXIT,
3333
else => @compileError("kqueue not supported yet for target OS"),
3434
};
3535

@@ -118,7 +118,7 @@ pub const Loop = struct {
118118
/// were unprocessed are lost -- their callbacks will never be called.
119119
pub fn deinit(self: *Loop) void {
120120
posix.close(self.kqueue_fd);
121-
self.mach_port.deinit();
121+
//self.mach_port.deinit();
122122
}
123123

124124
/// Stop the loop. This can only be called from the main thread.
@@ -966,14 +966,14 @@ pub const Loop = struct {
966966
c.task_loop.thread_pool_completions.push(c);
967967

968968
// Wake up our main loop
969-
c.task_loop.wakeup() catch {};
969+
//c.task_loop.wakeup() catch {};
970970
}
971971

972-
/// Sends an empty message to this loop's mach port so that it wakes
973-
/// up if it is blocking on kevent().
974-
fn wakeup(self: *Loop) !void {
972+
///// Sends an empty message to this loop's mach port so that it wakes
973+
///// up if it is blocking on kevent().
974+
//fn wakeup(self: *Loop) !void {
975975
//try self.mach_port.notify();
976-
}
976+
//}
977977
};
978978

979979
/// A completion is a request to perform some work with the loop.
@@ -1100,7 +1100,7 @@ pub const Completion = struct {
11001100
// .udata = @intFromPtr(self),
11011101
// .ext = .{ @intFromPtr(slice.ptr), slice.len },
11021102
//};
1103-
},
1103+
//},
11041104

11051105
.proc => |v| kevent_init(.{
11061106
.ident = @intCast(v.pid),

src/main.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pub const Backend = enum {
6666
pub fn candidates() []const Backend {
6767
return switch (builtin.os.tag) {
6868
.linux => &.{ .io_uring, .epoll },
69-
.ios, .macos => &.{.kqueue},
69+
.freebsd, .ios, .macos => &.{.kqueue},
7070
.wasi => &.{.wasi_poll},
7171
.windows => &.{.iocp},
7272
else => {

0 commit comments

Comments
 (0)