Skip to content

Commit

Permalink
tools: bpftool: fix compilation with older headers
Browse files Browse the repository at this point in the history
Compilation of bpftool on a distro that lacks eBPF support in the installed
kernel headers fails with:

common.c: In function ‘is_bpffs’:
common.c:96:40: error: ‘BPF_FS_MAGIC’ undeclared (first use in this function)
  return (unsigned long)st_fs.f_type == BPF_FS_MAGIC;
                                        ^
Fix this the same way it is already in tools/lib/bpf/libbpf.c and
tools/lib/api/fs/fs.c.

Signed-off-by: Jiri Benc <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
  • Loading branch information
Jiri Benc authored and borkmann committed Mar 6, 2018
1 parent d02f51c commit 20d5de5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tools/bpf/bpftool/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@

#include "main.h"

#ifndef BPF_FS_MAGIC
#define BPF_FS_MAGIC 0xcafe4a11
#endif

void p_err(const char *fmt, ...)
{
va_list ap;
Expand Down

0 comments on commit 20d5de5

Please sign in to comment.