Fix build with old kernel headers
* strace.c (print_debug_info, maybe_allocate_tcb, print_signalled,
print_exited): Remove "const" qualifier from status variable to
workaround some old implementations of WIFSIGNALED/WIFSTOPPED/WIFEXITED
macros.
* v4l2.c: Include <linux/types.h>.
(v4l2_ioctl): Check that V4L2_CTRL_FLAG_NEXT_CTRL and VIDIOC_S_EXT_CTRLS
macros are defined.
* tests/Makefile.am (AM_CPPFLAGS): Define.
diff --git a/strace.c b/strace.c
index f851c98..0e131a1 100644
--- a/strace.c
+++ b/strace.c
@@ -2030,7 +2030,7 @@
}
static void
-print_debug_info(const int pid, const int status)
+print_debug_info(const int pid, int status)
{
const unsigned int event = (unsigned int) status >> 16;
char buf[sizeof("WIFEXITED,exitcode=%u") + sizeof(int)*3 /*paranoia:*/ + 16];
@@ -2077,7 +2077,7 @@
}
static struct tcb *
-maybe_allocate_tcb(const int pid, const int status)
+maybe_allocate_tcb(const int pid, int status)
{
if (!WIFSTOPPED(status)) {
if (detach_on_execve && pid == strace_child) {
@@ -2160,7 +2160,7 @@
}
static void
-print_signalled(struct tcb *tcp, const int pid, const int status)
+print_signalled(struct tcb *tcp, const int pid, int status)
{
if (pid == strace_child) {
exit_code = 0x100 | WTERMSIG(status);
@@ -2184,7 +2184,7 @@
}
static void
-print_exited(struct tcb *tcp, const int pid, const int status)
+print_exited(struct tcb *tcp, const int pid, int status)
{
if (pid == strace_child) {
exit_code = WEXITSTATUS(status);
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e5899de..08d7a4d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,6 +1,10 @@
# Automake input for strace tests.
AM_CFLAGS = $(WARN_CFLAGS)
+AM_CPPFLAGS = -I$(top_builddir)/$(OS)/$(ARCH) \
+ -I$(top_srcdir)/$(OS)/$(ARCH) \
+ -I$(top_builddir)/$(OS) \
+ -I$(top_srcdir)/$(OS)
check_PROGRAMS = \
caps \
diff --git a/v4l2.c b/v4l2.c
index c4541d9..69ff618 100644
--- a/v4l2.c
+++ b/v4l2.c
@@ -31,6 +31,7 @@
#include <stdint.h>
#include <sys/ioctl.h>
+#include <linux/types.h>
#include <linux/videodev2.h>
/* some historical constants */
#ifndef V4L2_CID_HCENTER
@@ -353,11 +354,13 @@
if (entering(tcp)
|| (exiting(tcp) && tcp->auxstr && !syserror(tcp))) {
tprints(exiting(tcp) ? " => " : ", {id=");
+#ifdef V4L2_CTRL_FLAG_NEXT_CTRL
tcp->auxstr = (c.id & V4L2_CTRL_FLAG_NEXT_CTRL) ? "" : NULL;
if (tcp->auxstr) {
tprints("V4L2_CTRL_FLAG_NEXT_CTRL|");
c.id &= ~V4L2_CTRL_FLAG_NEXT_CTRL;
}
+#endif
printxval(v4l2_control_ids, c.id, "V4L2_CID_???");
}
if (exiting(tcp)) {
@@ -395,6 +398,7 @@
return 1;
}
+#ifdef VIDIOC_S_EXT_CTRLS
case VIDIOC_S_EXT_CTRLS:
case VIDIOC_TRY_EXT_CTRLS:
case VIDIOC_G_EXT_CTRLS: {
@@ -431,7 +435,7 @@
}
tprints("{id=");
printxval(v4l2_control_ids, ctrl.id, "V4L2_CID_???");
-#if HAVE_DECL_V4L2_CTRL_TYPE_STRING
+# if HAVE_DECL_V4L2_CTRL_TYPE_STRING
tprintf(", size=%u", ctrl.size);
if (ctrl.size > 0) {
if (must_print_values) {
@@ -439,7 +443,7 @@
printstr(tcp, (long) ctrl.string, ctrl.size);
}
} else
-#endif
+# endif
{
if (must_print_values) {
tprintf(", value=%i, value64=%lli", ctrl.value,
@@ -451,6 +455,7 @@
tprints("]}");
return 1;
}
+#endif /* VIDIOC_S_EXT_CTRLS */
case VIDIOC_ENUMSTD: {
struct v4l2_standard s;