Skip to content

Latest commit

 

History

History
100 lines (80 loc) · 4.4 KB

bpf_map_delete_elem.md

File metadata and controls

100 lines (80 loc) · 4.4 KB
title description
Helper Function 'bpf_map_delete_elem'
This page documents the 'bpf_map_delete_elem' eBPF helper function, including its defintion, usage, program types that can use it, and examples.

Helper function bpf_map_delete_elem

:octicons-tag-24: v3.19

The delete map element helper call is used to delete values from maps.

Definition

Copyright (c) 2015 The Libbpf Authors. All rights reserved.

Delete entry with key from map.

Returns

0 on success, or a negative error in case of failure.

#!c static long (* const bpf_map_delete_elem)(void *map, const void *key) = (void *) 3;

Usage

The map argument must be a pointer to a map definition and key must be a pointer to the key you wish to delete.

The return value will be 0 on success or a negative valued error number indicating a failure.

Program types

This helper call can be used in the following program types:

Map types

This helper call can be used with the following map types:

Example

int key, result;
key = 1;
result = bpf_map_delete_element(&my_map, &key);
if (result == 0)
	bpf_printk("Element deleted from the map\n");
else
	bpf_printk("Failed to delete element from the map: %d\n",result);