-
Notifications
You must be signed in to change notification settings - Fork 189
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 (#1477)
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 <[email protected]>
- Loading branch information
Showing
1 changed file
with
11 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters