Skip to content

Helper function bpf_kptr_xchg

v5.19

Definition

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

Exchange kptr at pointer dst with ptr, and return the old value. dst can be map value or local kptr. ptr can be NULL, otherwise it must be a referenced pointer which will be released when this helper is called.

Returns

The old value of kptr (which can be NULL). The returned pointer if not NULL, is a reference which must be released using its corresponding release function, or moved into a BPF map before program exit.

static void *(* const bpf_kptr_xchg)(void *dst, void *ptr) = (void *) 194;

Usage

Docs could be improved

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

Program types

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

Example

Docs could be improved

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