Skip to content

Libbpf userspace function bpf_map__delete_elem

0.8.0

Allows to delete element in BPF map that corresponds to provided key.

Definition

int bpf_map__delete_elem(const struct bpf_map *map, const void *key, size_t key_sz, __u64 flags);

Parameters

  • map: BPF map to delete element from
  • key: pointer to memory containing bytes of the key
  • key_sz: size in bytes of key data, needs to match BPF map definition's key_size
  • flags: flags passed to kernel for this operation

Return

0, on success; negative error, otherwise

Usage

bpf_map__delete_elem() is high-level equivalent of bpf_map_delete_elem() API with added check for key size.

Example

Docs could be improved

This part of the docs is incomplete, contributions are very welcome