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 › os › linux › bpf › map_create Public Function map_create Doc Source Public Function std.os.linux.bpf.map_create
pub fn map_create (map_type : MapType , key_size : u32 , value_size : u32 , max_entries : u32 ) !fd_t Params map_type : MapType key_size : u32 value_size : u32 max_entries : u32 File os/linux/bpf.zig: 1612
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630 pub fn map_create (map_type : MapType , key_size : u32 , value_size : u32 , max_entries : u32 ) !fd_t {
var attr = Attr {
.map_create = std .mem .zeroes (MapCreateAttr ),
};
attr .map_create .map_type = @backingInt (map_type );
attr .map_create .key_size = key_size ;
attr .map_create .value_size = value_size ;
attr .map_create .max_entries = max_entries ;
const rc = linux .bpf (.map_create , &attr , @sizeOf (MapCreateAttr ));
switch (errno (rc )) {
.SUCCESS => return @as (fd_t , @intCast (rc )),
.INVAL => return error .MapTypeOrAttrInvalid ,
.NOMEM => return error .SystemResources ,
.PERM => return error .PermissionDenied ,
else => |err | return unexpectedErrno (err ),
}
}