All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Lobakin <alobakin@pm.me>
To: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>
Cc: Alexander Lobakin <alobakin@pm.me>,
	Maciej Fijalkowski <maciej.fijalkowski@intel.com>,
	Song Liu <songliubraving@fb.com>,
	Kumar Kartikeya Dwivedi <memxor@gmail.com>,
	bpf@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2 bpf 09/11] samples/bpf: fix include order for non-Glibc environments
Date: Thu, 21 Apr 2022 00:39:46 +0000	[thread overview]
Message-ID: <20220421003152.339542-10-alobakin@pm.me> (raw)
In-Reply-To: <20220421003152.339542-1-alobakin@pm.me>

Some standard C library implementations, e.g. Musl, ship the UAPI
definitions themselves to not be dependent on the UAPI headers and
their versions. Their kernel UAPI counterparts are usually guarded
with some definitions which the formers set in order to avoid
duplicate definitions.
In such cases, include order matters. Change it in two samples: in
the first, kernel UAPI ioctl definitions should go before the libc
ones, and the opposite story with the second, where the kernel
includes should go later to avoid struct redefinitions.

Fixes: b4b8faa1ded7 ("samples/bpf: sample application and documentation for AF_XDP sockets")
Fixes: e55190f26f92 ("samples/bpf: Fix build for task_fd_query_user.c")
Acked-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Alexander Lobakin <alobakin@pm.me>
---
 samples/bpf/task_fd_query_user.c | 2 +-
 samples/bpf/xdpsock_user.c       | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/samples/bpf/task_fd_query_user.c b/samples/bpf/task_fd_query_user.c
index c9a0ca8351fd..c0ecca01d890 100644
--- a/samples/bpf/task_fd_query_user.c
+++ b/samples/bpf/task_fd_query_user.c
@@ -9,11 +9,11 @@
 #include <stdint.h>
 #include <fcntl.h>
 #include <linux/bpf.h>
+#include <linux/perf_event.h>
 #include <sys/ioctl.h>
 #include <sys/resource.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <linux/perf_event.h>

 #include <bpf/bpf.h>
 #include <bpf/libbpf.h>
diff --git a/samples/bpf/xdpsock_user.c b/samples/bpf/xdpsock_user.c
index 6f3fe30ad283..9747d47a0a8f 100644
--- a/samples/bpf/xdpsock_user.c
+++ b/samples/bpf/xdpsock_user.c
@@ -7,14 +7,15 @@
 #include <linux/bpf.h>
 #include <linux/if_link.h>
 #include <linux/if_xdp.h>
-#include <linux/if_ether.h>
 #include <linux/ip.h>
 #include <linux/limits.h>
+#include <linux/net.h>
 #include <linux/udp.h>
 #include <arpa/inet.h>
 #include <locale.h>
 #include <net/ethernet.h>
 #include <netinet/ether.h>
+#include <linux/if_ether.h>
 #include <net/if.h>
 #include <poll.h>
 #include <pthread.h>
--
2.36.0



  parent reply	other threads:[~2022-04-21  0:40 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21  0:38 [PATCH v2 bpf 00/11] bpf: random unpopular userspace fixes (32 bit et al) Alexander Lobakin
2022-04-21  0:38 ` [PATCH v2 bpf 01/11] bpftool: use a local copy of perf_event to fix accessing ::bpf_cookie Alexander Lobakin
2022-04-21  0:38 ` [PATCH v2 bpf 02/11] bpftool: define a local bpf_perf_link to fix accessing its fields Alexander Lobakin
2023-04-14  9:54   ` Michal Suchánek
2023-04-14 15:18     ` Alexander Lobakin
2023-04-14 16:28       ` Michal Suchánek
2023-04-20 23:07         ` Andrii Nakryiko
2023-04-21  7:39           ` Michal Suchánek
2023-05-03 23:43             ` Quentin Monnet
2023-05-03 23:52               ` Andrii Nakryiko
2023-05-04  8:18               ` Michal Suchánek
2023-05-04 16:48                 ` Yonghong Song
2022-04-21  0:39 ` [PATCH v2 bpf 03/11] bpftool: use a local bpf_perf_event_value " Alexander Lobakin
2023-06-06 21:02   ` Nick Desaulniers
2023-06-07 10:42     ` Quentin Monnet
2023-06-07 16:18     ` Alexander Lobakin
2022-04-21  0:39 ` [PATCH v2 bpf 04/11] bpftool: fix fcntl.h include Alexander Lobakin
2022-04-21  0:39 ` [PATCH v2 bpf 05/11] samples/bpf: add 'asm/mach-generic' include path for every MIPS Alexander Lobakin
2022-04-21  0:39 ` [PATCH v2 bpf 06/11] samples/bpf: use host bpftool to generate vmlinux.h, not target Alexander Lobakin
2022-04-21  0:39 ` [PATCH v2 bpf 07/11] samples/bpf: fix uin64_t format literals Alexander Lobakin
2022-04-21  7:46   ` David Laight
2022-04-21 22:55     ` Alexander Lobakin
2022-04-21  0:39 ` [PATCH v2 bpf 08/11] samples/bpf: fix false-positive right-shift underflow warnings Alexander Lobakin
2022-04-21  0:39 ` Alexander Lobakin [this message]
2022-04-21  0:39 ` [PATCH v2 bpf 10/11] samples/bpf: fix -Wsequence-point Alexander Lobakin
2022-04-21  0:39 ` [PATCH v2 bpf 11/11] samples/bpf: xdpsock: fix -Wmaybe-uninitialized Alexander Lobakin
2022-04-21  0:40 ` [PATCH v2 bpf 00/11] bpf: random unpopular userspace fixes (32 bit et al) Alexei Starovoitov
2022-04-21 10:52   ` Toke Høiland-Jørgensen
2022-04-21 22:39   ` Alexander Lobakin
2022-04-21 23:17     ` Toke Høiland-Jørgensen
2022-05-03 21:17   ` Alexander Lobakin
2022-05-04 11:34     ` Toke Høiland-Jørgensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220421003152.339542-10-alobakin@pm.me \
    --to=alobakin@pm.me \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=memxor@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.