Provide enum bpf_stats_type if not defined in linux/bpf.h for older kernel
This commit is contained in:
parent
8d02203bb6
commit
ef694923f7
19
configure.ac
19
configure.ac
|
@ -559,6 +559,25 @@ if test "x${request_libbpf}" != "xno"; then
|
||||||
# Add the include path for Debian
|
# Add the include path for Debian
|
||||||
EXTRABPFCFLAGS="-I/usr/include/$host_cpu-$host_os"
|
EXTRABPFCFLAGS="-I/usr/include/$host_cpu-$host_os"
|
||||||
AC_SUBST([EXTRABPFCFLAGS])
|
AC_SUBST([EXTRABPFCFLAGS])
|
||||||
|
|
||||||
|
AC_MSG_CHECKING([whether enum bpf_stats_type is defined in linux/bpf.h])
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
||||||
|
[[
|
||||||
|
#include <linux/bpf.h>
|
||||||
|
]],
|
||||||
|
[[
|
||||||
|
enum bpf_stats_type foo;
|
||||||
|
]])],
|
||||||
|
[have_bpf_stats_type=yes],
|
||||||
|
[have_bpf_stats_type=no])
|
||||||
|
|
||||||
|
if test "x${have_bpf_stats_type}" = "xyes"; then
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
AC_DEFINE([HAVE_BPF_STATS_TYPE], [1],
|
||||||
|
[Define to 1 if you have enum bpf_stats_type in linux/bpf.h.])
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
AC_MSG_NOTICE($LIBBPF_PKG_ERRORS)
|
AC_MSG_NOTICE($LIBBPF_PKG_ERRORS)
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -48,4 +48,11 @@
|
||||||
inline int initgroups(const char *user, gid_t group) { return 0; }
|
inline int initgroups(const char *user, gid_t group) { return 0; }
|
||||||
#endif // defined(HAVE_DECL_INITGROUPS) && !HAVE_DECL_INITGROUPS
|
#endif // defined(HAVE_DECL_INITGROUPS) && !HAVE_DECL_INITGROUPS
|
||||||
|
|
||||||
|
#ifndef HAVE_BPF_STATS_TYPE
|
||||||
|
/* Newer kernel should have this defined in linux/bpf.h */
|
||||||
|
enum bpf_stats_type {
|
||||||
|
BPF_STATS_RUN_TIME = 0,
|
||||||
|
};
|
||||||
|
#endif // !HAVE_BPF_STATS_TYPE
|
||||||
|
|
||||||
#endif // SHRPX_H
|
#endif // SHRPX_H
|
||||||
|
|
Loading…
Reference in New Issue