in pkg/maps/loader.go [420:447]
func (m *BpfMap) GetMapEntry(key, value uintptr) error {
mapFD, err := utils.GetMapFDFromID(int(m.MapID))
if err != nil {
log.Errorf("unable to GetMapFDfromID and ret %d and err %s", int(mapFD), err)
return fmt.Errorf("unable to get FD: %s", err)
}
defer unix.Close(mapFD)
attr := utils.BpfMapAttr{
MapFD: uint32(mapFD),
Key: uint64(key),
Value: uint64(value),
}
ret, _, errno := unix.Syscall(
unix.SYS_BPF,
uintptr(constdef.BPF_MAP_LOOKUP_ELEM),
uintptr(unsafe.Pointer(&attr)),
unsafe.Sizeof(attr),
)
if errno != 0 {
log.Errorf("unable to get map entry and ret %d and err %s", int(ret), errno)
return fmt.Errorf("unable to get next map entry: %s", errno)
}
log.Infof("Got map entry with fd : %d and err %s", int(ret), errno)
return nil
}