[PATCH] v4l2.c: add decoding for VIDIOC_CREATE_BUFS's arg.
Dmitry V. Levin
ldv at altlinux.org
Thu Apr 16 18:56:30 UTC 2015
On Thu, Apr 16, 2015 at 03:33:34PM +0200, Philippe De Muyter wrote:
> * v4l2.c (v4l2_ioctl): Add decoding for VIDIOC_CREATE_BUFS's arg.
> ---
> v4l2.c | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/v4l2.c b/v4l2.c
> index ae1ebb8..c121c61 100644
> --- a/v4l2.c
> +++ b/v4l2.c
> @@ -581,6 +581,32 @@ v4l2_ioctl(struct tcb *tcp, const unsigned int code, long arg)
> return 1;
> }
>
> + case VIDIOC_CREATE_BUFS: {
> + struct v4l2_create_buffers b;
> +
> + if (umove(tcp, arg, &b) < 0)
> + return 0;
> + if (entering(tcp)) {
> + tprintf(", {count=%u, memory=", b.count);
> + printxval(v4l2_memories, b.memory, "V4L2_MEMORY_???");
> + tprints(", format={type=");
> + printxval(v4l2_buf_types, b.format.type, "V4L2_BUF_TYPE_???");
> + tprints(", ");
> + print_v4l2_format_fmt(&b.format);
> + tprints("}}");
> + return 1;
> + } else if (syserror(tcp))
> + return 1;
The check for syserror should go first:
if (exiting(tcp) && syserror(tcp))
return 1;
if (umove(...) < 0)
return 0;
if entering(tcp)) {
...
} else {
...
}
> + else {
> + static char fmt[] = "{index=%u, count=%u}";
This fmt does not have to be static.
> + static char outstr[sizeof(fmt) + sizeof(int) * 6];
> +
> + sprintf(outstr, fmt, b.index, b.count);
> + tcp->auxstr = outstr;
> + return 1 + RVAL_STR;
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20150416/e5523f07/attachment.bin>
More information about the Strace-devel
mailing list