summaryrefslogtreecommitdiff
path: root/tools/lib/bpf/libbpf.h
diff options
context:
space:
mode:
authorJP Kobryn <inwardvessel@gmail.com>2023-03-25 04:08:45 +0300
committerAndrii Nakryiko <andrii@kernel.org>2023-03-27 21:33:43 +0300
commitf1cb927cdb6280e0ce283174cc1bf395dffc43d4 (patch)
treed9797bbb0073a28680c76bf7fe862a4272d5a285 /tools/lib/bpf/libbpf.h
parent5f5a7d8d8bd461f515543040ad7d107cc405d30c (diff)
downloadlinux-f1cb927cdb6280e0ce283174cc1bf395dffc43d4.tar.xz
libbpf: Ensure print callback usage is thread-safe
This patch prevents races on the print function pointer, allowing the libbpf_set_print() function to become thread-safe. Signed-off-by: JP Kobryn <inwardvessel@gmail.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20230325010845.46000-1-inwardvessel@gmail.com
Diffstat (limited to 'tools/lib/bpf/libbpf.h')
-rw-r--r--tools/lib/bpf/libbpf.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
index 1615e55e2e79..0b7362397ea3 100644
--- a/tools/lib/bpf/libbpf.h
+++ b/tools/lib/bpf/libbpf.h
@@ -101,6 +101,8 @@ typedef int (*libbpf_print_fn_t)(enum libbpf_print_level level,
* be used for libbpf warnings and informational messages.
* @param fn The log print function. If NULL, libbpf won't print anything.
* @return Pointer to old print function.
+ *
+ * This function is thread-safe.
*/
LIBBPF_API libbpf_print_fn_t libbpf_set_print(libbpf_print_fn_t fn);