1 /* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */
4 * Libbpf legacy APIs (either discouraged or deprecated, as mentioned in [0])
6 * [0] https://docs.google.com/document/d/1UyjTZuPFWiPFyKk1tV5an11_iaRuec6U-ZESZ54nNTY
8 * Copyright (C) 2021 Facebook
10 #ifndef __LIBBPF_LEGACY_BPF_H
11 #define __LIBBPF_LEGACY_BPF_H
13 #include <linux/bpf.h>
17 #include "libbpf_common.h"
23 enum libbpf_strict_mode {
24 /* Turn on all supported strict features of libbpf to simulate libbpf
26 * This will be the default behavior in libbpf v1.0.
28 LIBBPF_STRICT_ALL = 0xffffffff,
31 * Disable any libbpf 1.0 behaviors. This is the default before libbpf
32 * v1.0. It won't be supported anymore in v1.0, please update your
33 * code so that it handles LIBBPF_STRICT_ALL mode before libbpf v1.0.
35 LIBBPF_STRICT_NONE = 0x00,
37 * Return NULL pointers on error, not ERR_PTR(err).
38 * Additionally, libbpf also always sets errno to corresponding Exx
39 * (positive) error code.
41 LIBBPF_STRICT_CLEAN_PTRS = 0x01,
43 * Return actual error codes from low-level APIs directly, not just -1.
44 * Additionally, libbpf also always sets errno to corresponding Exx
45 * (positive) error code.
47 LIBBPF_STRICT_DIRECT_ERRS = 0x02,
52 LIBBPF_API int libbpf_set_strict_mode(enum libbpf_strict_mode mode);
59 #endif /* __LIBBPF_LEGACY_BPF_H */