From 9acc2417753227c6d4dddb8a28a89124a5569a14 Mon Sep 17 00:00:00 2001 From: Eugene Syromyatnikov Date: Sat, 16 Sep 2017 02:56:14 +0200 Subject: [PATCH] tests/kcmp: use if it is available I see it as a good idea to stick to system headers whenever possible in order to also check for possible discrepancies between strace's internal definitions and definitions present in the system headers. * configure.ac (AC_CHECK_HEADERS): Add linux/kcmp.h. * tests/kcmp.h [HAVE_LINUX_KCMP_H]: Include , do not define KCMP_FILE and KCMP_SYSVSEM. --- configure.ac | 1 + tests/kcmp.c | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index c68046b0..7e3b6be4 100644 --- a/configure.ac +++ b/configure.ac @@ -390,6 +390,7 @@ AC_CHECK_HEADERS(m4_normalize([ linux/if_link.h linux/ip_vs.h linux/ipc.h + linux/kcmp.h linux/mmtimer.h linux/msg.h linux/neighbour.h diff --git a/tests/kcmp.c b/tests/kcmp.c index cb497c9f..e3425cdf 100644 --- a/tests/kcmp.c +++ b/tests/kcmp.c @@ -37,8 +37,18 @@ # include # include -# define KCMP_FILE 0 -# define KCMP_SYSVSEM 6 + +/* + * We prefer to use system headers in order to catch some possible deviations in + * system's headers from our perception of reality, but happy to include our own + * definitions as well. + */ +# ifdef HAVE_LINUX_KCMP_H +# include +# else +# define KCMP_FILE 0 +# define KCMP_SYSVSEM 6 +# endif static void do_kcmp(kernel_ulong_t pid1, kernel_ulong_t pid2, kernel_ulong_t type, -- 2.40.0