]> granicus.if.org Git - strace/commitdiff
tests/kcmp: use <linux/kcmp.h> if it is available
authorEugene Syromyatnikov <evgsyr@gmail.com>
Sat, 16 Sep 2017 00:56:14 +0000 (02:56 +0200)
committerDmitry V. Levin <ldv@altlinux.org>
Sun, 17 Sep 2017 12:04:11 +0000 (12:04 +0000)
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 <linux/kcmp.h>,
do not define KCMP_FILE and KCMP_SYSVSEM.

configure.ac
tests/kcmp.c

index c68046b02586caf0bd3022de9b7aee493a2b986a..7e3b6be4ef4bec21ecba4112e6a4636ea8f559d7 100644 (file)
@@ -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
index cb497c9f2f6aa58c8fa4cce2e1404b2558213221..e3425cdfaf6888c6da61a10192c6671f4ca0c277 100644 (file)
 # include <stdio.h>
 # include <unistd.h>
 
-# 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 <linux/kcmp.h>
+# 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,