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_update_elem Public Function map_update_elem Doc Source Public Function std.os.linux.bpf.map_update_elem
pub fn map_update_elem (fd : fd_t , key : []const u8 , value : []const u8 , flags : u64 ) !void Params fd : fd_t key : []const u8 value : []const u8 flags : u64 File os/linux/bpf.zig: 1658
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679 pub fn map_update_elem (fd : fd_t , key : []const u8 , value : []const u8 , flags : u64 ) !void {
var attr = Attr {
.map_elem = std .mem .zeroes (MapElemAttr ),
};
attr .map_elem .map_fd = fd ;
attr .map_elem .key = @intFromPtr (key .ptr );
attr .map_elem .result = .{ .value = @intFromPtr (value .ptr ) };
attr .map_elem .flags = flags ;
const rc = linux .bpf (.map_update_elem , &attr , @sizeOf (MapElemAttr ));
switch (errno (rc )) {
.SUCCESS => return ,
.@"2BIG" => return error .ReachedMaxEntries ,
.BADF => return error .BadFd ,
.FAULT => unreachable ,
.INVAL => return error .FieldInAttrNeedsZeroing ,
.NOMEM => return error .SystemResources ,
.PERM => return error .PermissionDenied ,
else => |err | return unexpectedErrno (err ),
}
}