feature. See also
. The project being documented here (as the example) is the Zig library itself.
Kqueue.kevent
pub fn kevent(
kq: i32,
changelist: []const posix.Kevent,
eventlist: []posix.Kevent,
timeout: ?*const posix.timespec,
) KEventError!usize
File
Code
pub fn kevent(
kq: i32,
changelist: []const posix.Kevent,
eventlist: []posix.Kevent,
timeout: ?*const posix.timespec,
) KEventError!usize {
while (true) {
const rc = posix.system.kevent(
kq,
changelist.ptr,
std.math.cast(c_int, changelist.len) orelse return error.Overflow,
eventlist.ptr,
std.math.cast(c_int, eventlist.len) orelse return error.Overflow,
timeout,
);
switch (posix.errno(rc)) {
.SUCCESS => return @intCast(rc),
.ACCES => return error.AccessDenied,
.FAULT => unreachable,
.BADF => unreachable,
.INTR => continue,
.INVAL => unreachable,
.NOENT => return error.EventNotFound,
.NOMEM => return error.SystemResources,
.SRCH => return error.ProcessNotFound,
else => unreachable,
}
}
}