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 › posixBind Private Function posixBind Doc Source Private Function std.Io.Kqueue.posixBind
fn posixBind (
k : *Kqueue ,
socket_fd : posix .socket_t ,
addr : *const posix .sockaddr ,
addr_len : posix .socklen_t ,
) !void Params File Io/Kqueue.zig: 1393
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418 fn posixBind (
k : *Kqueue ,
socket_fd : posix .socket_t ,
addr : *const posix .sockaddr ,
addr_len : posix .socklen_t ,
) !void {
while (true ) {
try k .checkCancel ();
switch (posix .errno (posix .system .bind (socket_fd , addr , addr_len ))) {
.SUCCESS => break ,
.INTR => continue ,
.CANCELED => return error .Canceled ,
.ACCES => return error .AccessDenied ,
.ADDRINUSE => return error .AddressInUse ,
.BADF => |err | return errnoBug (err ), // File descriptor used after closed.
.INVAL => |err | return errnoBug (err ), // invalid parameters
.NOTSOCK => |err | return errnoBug (err ), // invalid `sockfd`
.AFNOSUPPORT => return error .AddressFamilyUnsupported ,
.ADDRNOTAVAIL => return error .AddressUnavailable ,
.FAULT => |err | return errnoBug (err ), // invalid `addr` pointer
.NOMEM => return error .SystemResources ,
else => |err | return posix .unexpectedErrno (err ),
}
}
}