mirror of
https://github.com/netdata/libbpf.git
synced 2026-03-29 04:39:06 +08:00
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 Signed-off-by: Daniel Müller <deso@posteo.net>
This commit is contained in:
committed by
Andrii Nakryiko
parent
b362bb6e10
commit
ae32d7169d
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user