Commit 8a4dd0bc authored by Daniel T. Lee's avatar Daniel T. Lee Committed by Andrii Nakryiko
Browse files

samples/bpf: Use vmlinux.h instead of implicit headers in syscall tracing program



This commit applies vmlinux.h to syscall tracing program. This change
allows the bpf program to refer to the internal structure as a single
"vmlinux.h" instead of including each header referenced by the bpf
program.

Signed-off-by: default avatarDaniel T. Lee <danieltimlee@gmail.com>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20221224071527.2292-3-danieltimlee@gmail.com
parent 1d0c5f6f
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -4,10 +4,9 @@
 * modify it under the terms of version 2 of the GNU General Public
 * License as published by the Free Software Foundation.
 */
#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include "vmlinux.h"
#include <errno.h>
#include <linux/version.h>
#include <uapi/linux/bpf.h>
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>
#include <bpf/bpf_core_read.h>
+1 −3
Original line number Diff line number Diff line
@@ -5,11 +5,9 @@
 * License as published by the Free Software Foundation.
 */

#include <linux/ptrace.h>
#include <uapi/linux/bpf.h>
#include "vmlinux.h"
#include <linux/version.h>
#include <bpf/bpf_helpers.h>
#include <uapi/linux/utsname.h>

struct {
	__uint(type, BPF_MAP_TYPE_CGROUP_ARRAY);
+2 −3
Original line number Diff line number Diff line
@@ -4,9 +4,8 @@
 * modify it under the terms of version 2 of the GNU General Public
 * License as published by the Free Software Foundation.
 */
#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <uapi/linux/bpf.h>
#include "vmlinux.h"
#include <string.h>
#include <linux/version.h>
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>
+1 −2
Original line number Diff line number Diff line
#include <linux/ptrace.h>
#include "vmlinux.h"
#include <linux/version.h>
#include <uapi/linux/bpf.h>
#include <bpf/bpf_helpers.h>

struct {
+1 −3
Original line number Diff line number Diff line
@@ -4,10 +4,8 @@
 * modify it under the terms of version 2 of the GNU General Public
 * License as published by the Free Software Foundation.
 */
#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include "vmlinux.h"
#include <linux/version.h>
#include <uapi/linux/bpf.h>
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>