Commit cfd3bfe9 authored by Dmitrii Bundin's avatar Dmitrii Bundin Committed by Andrii Nakryiko

bpf: Include linux/types.h for u32

Inclusion of the header linux/btf_ids.h relies on indirect inclusion of
the header linux/types.h. Including it directly on the top level helps
to avoid potential problems if linux/types.h hasn't been included
before.

The main motivation to introduce this it is to avoid similar problems that
have shown up in the bpftool where GNU libc indirectly pulls
linux/types.h causing compile error of the form:

   error: unknown type name 'u32'
                             u32 cnt;
                             ^~~

The bpftool compile error was fixed in
62248b22 ("tools/resolve_btfids: fix build with musl libc").
Signed-off-by: default avatarDmitrii Bundin <dmitrii.bundin.a@gmail.com>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20240420042457.3198883-1-dmitrii.bundin.a@gmail.com
parent 789d9a53
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
#ifndef _LINUX_BTF_IDS_H #ifndef _LINUX_BTF_IDS_H
#define _LINUX_BTF_IDS_H #define _LINUX_BTF_IDS_H
#include <linux/types.h> /* for u32 */
struct btf_id_set { struct btf_id_set {
u32 cnt; u32 cnt;
u32 ids[]; u32 ids[];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment