Libbpf userspace function bpf_map_lookup_and_delete_batch
Allows for batch lookup and deletion of BPF map elements where each element is deleted after being retrieved.
Definition
int bpf_map_lookup_and_delete_batch(int fd, void *in_batch, void *out_batch, void *keys, void *values, __u32 *count, const struct bpf_map_batch_opts *opts);
Parameters
fd
: BPF map file descriptorin_batch
: address of the first element in batch to read, can passNULL
to get address of the first element inout_batch
. If notNULL
, must be large enough to hold a key. For BPF_MAP_TYPE_{HASH, PERCPU_HASH, LRU_HASH, LRU_PERCPU_HASH}, the memory size must be at least 4 bytes wide regardless of key size.out_batch
: output parameter that should be passed to next call asin_batch
keys
: pointer to an array ofcount
keysvalues
: pointer to an array large enough forcount
valuescount
: input and output parameter; on input it's the number of elements in the map to read and delete in batch; on output it represents the number of elements that were successfully read and deleted If a non-EFAULT
error code is returned and if the outputcount
value is not equal to the inputcount
value, up tocount
elements may have been deleted. ifEFAULT
is returned up tocount
elements may have been deleted without being returned via thekeys
andvalues
output parameters.opts
: options for configuring the way the batch lookup and delete works
Return
0
, on success; negative error code, otherwise (errno
is also set to the error code)
Usage
Docs could be improved
This part of the docs is incomplete, contributions are very welcome
Example
Docs could be improved
This part of the docs is incomplete, contributions are very welcome