From: Dmitry V. Levin Date: Sun, 22 Feb 2015 02:13:04 +0000 (+0000) Subject: Fix build with old kernel headers X-Git-Tag: v4.10~90 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0f4ad30bdcb284a8e874b3d9345cb203c8cc5209;p=strace 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 . (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 f851c985..0e131a12 100644 --- a/strace.c +++ b/strace.c @@ -2030,7 +2030,7 @@ interrupt(int sig) } 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 @@ print_debug_info(const int pid, const int status) } 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 @@ maybe_switch_tcbs(struct tcb *tcp, const int pid) } 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 @@ print_signalled(struct tcb *tcp, const int pid, const int status) } 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 e5899de7..08d7a4d6 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 c4541d9f..69ff6186 100644 --- a/v4l2.c +++ b/v4l2.c @@ -31,6 +31,7 @@ #include #include +#include #include /* some historical constants */ #ifndef V4L2_CID_HCENTER @@ -353,11 +354,13 @@ v4l2_ioctl(struct tcb *tcp, const unsigned int code, long arg) 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 @@ v4l2_ioctl(struct tcb *tcp, const unsigned int code, long arg) 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 @@ v4l2_ioctl(struct tcb *tcp, const unsigned int code, long arg) } 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 @@ v4l2_ioctl(struct tcb *tcp, const unsigned int code, long arg) 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 @@ v4l2_ioctl(struct tcb *tcp, const unsigned int code, long arg) tprints("]}"); return 1; } +#endif /* VIDIOC_S_EXT_CTRLS */ case VIDIOC_ENUMSTD: { struct v4l2_standard s;