Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ensure all entries from bpf map is copied
Previously only a `MapSize` (lesser than size of processs) of entries used to be copied from processes bpf map. The right use of a batch size less than the size of map is as follows: Ref: https://lwn.net/Articles/797808/ ``` p_key = NULL; p_next_key = &key; while (true) { err = bpf_map_lookup_batch(fd, p_key, &p_next_key, keys, values, &batch_size, elem_flags, flags); if (err) ... if (p_next_key) break; // done if (!p_key) p_key = p_next_key; } ``` This PR fixes the issue by creating a entries byte array with the same size as the `processes` map. Additionally, this commit makes use of `bytes.Reader` instead of bytes.Buffer to avoid unnecessary copy of ephemeral byte array. Signed-off-by: Sunil Thaha <sthaha@redhat.com>
- Loading branch information