Zig 0.17.0-dev (Split by item) This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig standard library.
std › Io › Kqueue › setSocketOption Private Function setSocketOption Doc Source Private Function std.Io.Kqueue.setSocketOption
fn setSocketOption (k : *Kqueue , fd : posix .fd_t , level : i32 , opt_name : u32 , option : u32 ) !void Params k : *Kqueue fd : posix .fd_t level : i32 opt_name : u32 option : u32 File Io/Kqueue.zig: 1438
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454 fn setSocketOption (k : *Kqueue , fd : posix .fd_t , level : i32 , opt_name : u32 , option : u32 ) !void {
const o : []const u8 = @ptrCast (&option );
while (true ) {
try k .checkCancel ();
switch (posix .errno (posix .system .setsockopt (fd , level , opt_name , o .ptr , @intCast (o .len )))) {
.SUCCESS => return ,
.INTR => continue ,
.CANCELED => return error .Canceled ,
.BADF => |err | return errnoBug (err ), // File descriptor used after closed.
.NOTSOCK => |err | return errnoBug (err ),
.INVAL => |err | return errnoBug (err ),
.FAULT => |err | return errnoBug (err ),
else => |err | return posix .unexpectedErrno (err ),
}
}
}