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/ › os/ › linux/ › bpf.zig › map_create
map_create
bpf.map_create
pub fn map_create (map_type : MapType , key_size : u32 , value_size : u32 , max_entries : u32 ) !fd_t
File
Code
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 ),
}
}