]> granicus.if.org Git - strace/commitdiff
Fix build with old kernel headers
authorDmitry V. Levin <ldv@altlinux.org>
Sun, 22 Feb 2015 02:13:04 +0000 (02:13 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Sun, 22 Feb 2015 02:29:54 +0000 (02:29 +0000)
* 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.

strace.c
tests/Makefile.am
v4l2.c

index f851c985831248838b37c3741b2e4b4a1af65570..0e131a12761eebfa2b0fc8cad1eff417c87a7787 100644 (file)
--- 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);
index e5899de75ee6fbe416e257cc4ce95a01bd542736..08d7a4d63c6e2b02066e1bfbfd30f8d4d0ea737f 100644 (file)
@@ -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 c4541d9fc3b25aabf8df097e851cdb4c17f7eb34..69ff618697cbf39d18b12da6bc27e0e4b1de1fef 100644 (file)
--- 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 @@ 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;