Function map_lookup_elem [src]

Prototype

pub fn map_lookup_elem(fd: fd_t, key: []const u8, value: []u8) !void

Parameters

fd: fd_tkey: []const u8value: []u8

Source

pub fn map_lookup_elem(fd: fd_t, key: []const u8, value: []u8) !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); const rc = linux.bpf(.map_lookup_elem, &attr, @sizeOf(MapElemAttr)); switch (errno(rc)) { .SUCCESS => return, .BADF => return error.BadFd, .FAULT => unreachable, .INVAL => return error.FieldInAttrNeedsZeroing, .NOENT => return error.NotFound, .PERM => return error.PermissionDenied, else => |err| return unexpectedErrno(err), } }