in pkg/maps/loader.go [675:703]
func GetMapEntryByID(key, value uintptr, mapID int) error {
mapFD, err := utils.GetMapFDFromID(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 ret : %d and err %s", int(ret), errno)
return nil
}