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 library itself.
Zig › std/ › Io/ › Threaded.zig › bindSocketUnixAfd
bindSocketUnixAfd
Threaded.bindSocketUnixAfd
fn bindSocketUnixAfd (socket_handle : net .Socket .Handle , address : *const net .UnixAddress ) !void
File
Code
fn bindSocketUnixAfd (socket_handle : net .Socket .Handle , address : *const net .UnixAddress ) !void {
const Storage = extern struct { Info : windows .AFD .BIND_INFO , Address : UnixAddress };
var storage : Storage = .{ .Info = .{ .Mode = .Unix }, .Address = undefined };
const addr_len = addressUnixToPosix (address , &storage .Address );
switch ((try deviceIoControl (&.{
.file = .{ .handle = socket_handle , .flags = .{ .nonblocking = true } },
.code = windows .IOCTL .AFD .BIND ,
.in = @as ([]const u8 , @ptrCast (&storage ))[0 .. @offsetOf (Storage , "Address" ) + addr_len ],
.out = @ptrCast (&storage .Address ),
})).u .Status ) {
.SUCCESS => {},
.CANCELLED => unreachable ,
.INSUFFICIENT_RESOURCES => return error .SystemResources ,
.ADDRESS_ALREADY_EXISTS => return error .AddressInUse ,
else => |status | return windows .unexpectedStatus (status ),
}
}