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.
This commit is contained in:
Дмитрий Левин 2015-02-22 02:13:04 +00:00
parent 87c715b32c
commit 0f4ad30bdc
3 changed files with 15 additions and 6 deletions

View File

@ -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);

View 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 \

9
v4l2.c
View File

@ -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;