strace/tests/ioctl_v4l2.c
Eugene Syromyatnikov 13c467bf69 tests: fix "constant is too large" compilation warnings
alarm.c: In function 'main':
alarm.c:41: warning: integer constant is too large for 'long' type
aio.c: In function 'main':
aio.c:162: warning: integer constant is too large for 'long' type
btrfs.c: In function 'btrfs_test_sync_ioctls':
btrfs.c:202: warning: integer constant is too large for 'long' type
btrfs.c: In function 'btrfs_test_subvol_ioctls':
btrfs.c:289: warning: integer constant is too large for 'long' type
btrfs.c:290: warning: integer constant is too large for 'long' type
dup2.c: In function 'main':
dup2.c:12: warning: integer constant is too large for 'long' type
dup2.c:13: warning: integer constant is too large for 'long' type
dup3.c: In function 'main':
dup3.c:13: warning: integer constant is too large for 'long' type
dup3.c:14: warning: integer constant is too large for 'long' type
epoll_create.c: In function 'main':
epoll_create.c:12: warning: integer constant is too large for 'long' type
epoll_ctl.c: In function 'invoke_syscall':
epoll_ctl.c:14: warning: integer constant is too large for 'long' type
faccessat.c: In function 'main':
faccessat.c:13: warning: integer constant is too large for 'long' type
fchdir.c: In function 'main':
fchdir.c:12: warning: integer constant is too large for 'long' type
struct_flock.c: In function 'invoke_test_syscall':
struct_flock.c:48: warning: integer constant is too large for 'long' type
struct_flock.c: In function 'test_flock_einval':
struct_flock.c:58: warning: integer constant is too large for 'long' type
struct_flock.c:59: warning: integer constant is too large for 'long' type
fcntl64.c: In function 'test_flock64_einval':
fcntl64.c:44: warning: integer constant is too large for 'long' type
fcntl64.c:45: warning: integer constant is too large for 'long' type
fcntl.c: In function 'test_flock64_einval':
fcntl.c:44: warning: integer constant is too large for 'long' type
fcntl.c:45: warning: integer constant is too large for 'long' type
fdatasync.c: In function 'main':
fdatasync.c:12: warning: integer constant is too large for 'long' type
flock.c: In function 'main':
flock.c:13: warning: integer constant is too large for 'long' type
xstatx.c: In function 'main':
xstatx.c:255: warning: integer constant is too large for 'long' type
xstatx.c:290: warning: integer constant is too large for 'long' type
xstatx.c:290: warning: integer constant is too large for 'long' type
xstatx.c:290: warning: integer constant is too large for 'long' type
xstatx.c:290: warning: integer constant is too large for 'long' type
xstatx.c:290: warning: integer constant is too large for 'long' type
xstatx.c:290: warning: integer constant is too large for 'long' type
xstatx.c:290: warning: integer constant is too large for 'long' type
xstatx.c:290: warning: integer constant is too large for 'long' type
xstatx.c:290: warning: integer constant is too large for 'long' type
xstatx.c:294: warning: integer constant is too large for 'long' type
xstatx.c:294: warning: integer constant is too large for 'long' type
xstatx.c:294: warning: integer constant is too large for 'long' type
xstatx.c:294: warning: integer constant is too large for 'long' type
xstatx.c:294: warning: integer constant is too large for 'long' type
xstatx.c:294: warning: integer constant is too large for 'long' type
xstatx.c:294: warning: integer constant is too large for 'long' type
xstatx.c:294: warning: integer constant is too large for 'long' type
xstatx.c:294: warning: integer constant is too large for 'long' type
xstatfsx.c: In function 'main':
xstatfsx.c:113: warning: integer constant is too large for 'long' type
fsync.c: In function 'main':
fsync.c:12: warning: integer constant is too large for 'long' type
ftruncate64.c: In function 'main':
ftruncate64.c:39: warning: integer constant is too large for 'long' type
futimesat.c: In function 'main':
futimesat.c:52: warning: integer constant is too large for 'long' type
futimesat.c:59: warning: integer constant is too large for 'long' type
get_mempolicy.c: In function 'main':
get_mempolicy.c:83: warning: integer constant is too large for 'long' type
get_mempolicy.c:84: warning: integer constant is too large for 'long' type
get_mempolicy.c:85: warning: integer constant is too large for 'long' type
get_mempolicy.c:86: warning: integer constant is too large for 'long' type
getdents.c: In function 'main':
getdents.c:109: warning: integer constant is too large for 'long' type
getdents.c:110: warning: integer constant is too large for 'long' type
getdents.c:114: warning: integer constant is too large for 'long' type
getdents64.c: In function 'main':
getdents64.c:114: warning: integer constant is too large for 'long' type
getdents64.c:115: warning: integer constant is too large for 'long' type
getdents64.c:119: warning: integer constant is too large for 'long' type
xgetrlimit.c: In function 'main':
xgetrlimit.c:71: warning: integer constant is too large for 'long' type
ioctl_block.c:44: warning: integer constant is too large for 'long' type
ioctl_block.c: In function 'main':
ioctl_block.c:136: warning: integer constant is too large for 'long' type
ioctl_block.c:137: warning: integer constant is too large for 'long' type
ioctl_block.c:161: warning: integer constant is too large for 'long' type
ioctl_block.c:170: warning: integer constant is too large for 'long' type
ioctl_block.c:171: warning: integer constant is too large for 'long' type
ioctl_evdev.c:42: warning: integer constant is too large for 'long' type
ioctl_mtd.c:46: warning: integer constant is too large for 'long' type
ioctl_rtc.c:40: warning: integer constant is too large for 'long' type
ioperm.c: In function 'main':
ioperm.c:12: warning: integer constant is too large for 'long' type
ioctl_v4l2.c: In function 'main':
ioctl_v4l2.c:409: warning: integer constant is too large for 'long' type
ipc.c: In function 'ipc_call':
ipc.c:52: warning: integer constant is too large for 'long' type
kill.c: In function 'main':
kill.c:59: warning: integer constant is too large for 'long' type
kill.c:62: warning: integer constant is too large for 'long' type
kill.c:63: warning: integer constant is too large for 'long' type
kill.c:68: warning: integer constant is too large for 'long' type
linkat.c: In function 'main':
linkat.c:14: warning: integer constant is too large for 'long' type
linkat.c:15: warning: integer constant is too large for 'long' type
mbind.c: In function 'main':
mbind.c:41: warning: integer constant is too large for 'long' type
mbind.c:43: warning: integer constant is too large for 'long' type
mbind.c:44: warning: integer constant is too large for 'long' type
migrate_pages.c: In function 'main':
migrate_pages.c:41: warning: integer constant is too large for 'long' type
In file included from mkdirat.c:10:
umode_t.c: In function 'test_syscall':
umode_t.c:47: warning: integer constant is too large for 'long' type
mknod.c: In function 'call_mknod':
mknod.c:16: warning: integer constant is too large for 'long' type
mknod.c: In function 'main':
mknod.c:23: warning: integer constant is too large for 'long' type
mknod.c:49: warning: integer constant is too large for 'long' type
mknod.c:56: warning: integer constant is too large for 'long' type
mknodat.c:12: warning: integer constant is too large for 'long' type
mknodat.c: In function 'call_mknodat':
mknodat.c:17: warning: integer constant is too large for 'long' type
mknodat.c: In function 'main':
mknodat.c:24: warning: integer constant is too large for 'long' type
mknodat.c:50: warning: integer constant is too large for 'long' type
mknodat.c:57: warning: integer constant is too large for 'long' type
mmap.c: In function 'main':
mmap.c:51: warning: integer constant is too large for 'long' type
move_pages.c: In function 'print_stat_pages':
move_pages.c:139: warning: integer constant is too large for 'long' type
move_pages.c: In function 'print_move_pages':
move_pages.c:166: warning: integer constant is too large for 'long' type
move_pages.c: In function 'main':
move_pages.c:188: warning: integer constant is too large for 'long' type
mq_sendrecv.c: In function 'main':
mq_sendrecv.c:238: warning: integer constant is too large for 'long' type
mq_sendrecv.c:401: warning: integer constant is too large for 'long' type
mq_sendrecv.c:403: warning: integer constant is too large for 'long' type
nsyscalls.c: In function 'test_syscall':
nsyscalls.c:64: warning: integer constant is too large for 'long' type
nsyscalls.c:65: warning: integer constant is too large for 'long' type
nsyscalls.c:66: warning: integer constant is too large for 'long' type
nsyscalls.c:67: warning: integer constant is too large for 'long' type
nsyscalls.c:68: warning: integer constant is too large for 'long' type
nsyscalls.c:69: warning: integer constant is too large for 'long' type
preadv-pwritev.c: In function 'main':
preadv-pwritev.c:162: warning: comparison between signed and unsigned
prlimit64.c: In function 'main':
prlimit64.c:65: warning: integer constant is too large for 'long' type
prlimit64.c:70: warning: integer constant is too large for 'long' type
remap_file_pages.c: In function 'main':
remap_file_pages.c:42: warning: integer constant is too large for 'long' type
remap_file_pages.c:43: warning: integer constant is too large for 'long' type
remap_file_pages.c:45: warning: integer constant is too large for 'long' type
renameat.c: In function 'main':
renameat.c:15: warning: integer constant is too large for 'long' type
renameat.c:16: warning: integer constant is too large for 'long' type
rt_sigqueueinfo.c: In function 'main':
rt_sigqueueinfo.c:41: warning: integer constant is too large for 'long' type
rt_tgsigqueueinfo.c: In function 'k_tgsigqueueinfo':
rt_tgsigqueueinfo.c:45: warning: integer constant is too large for 'long' type
rt_tgsigqueueinfo.c:46: warning: integer constant is too large for 'long' type
rt_tgsigqueueinfo.c:47: warning: integer constant is too large for 'long' type
rt_tgsigqueueinfo.c: In function 'main':
rt_tgsigqueueinfo.c:67: warning: integer constant is too large for 'long' type
sendfile.c: In function 'main':
sendfile.c:110: warning: integer constant is too large for 'long' type
sendfile64.c: In function 'main':
sendfile64.c💯 warning: integer constant is too large for 'long' type
set_mempolicy.c: In function 'main':
set_mempolicy.c:129: warning: integer constant is too large for 'long' type
set_mempolicy.c:130: warning: integer constant is too large for 'long' type
setrlimit.c: In function 'main':
setrlimit.c:44: warning: integer constant is too large for 'long' type
socketcall.c: In function 'test_socketcall':
socketcall.c:58: warning: integer constant is too large for 'long' type
splice.c: In function 'main':
splice.c:41: warning: integer constant is too large for 'long' type
splice.c:42: warning: integer constant is too large for 'long' type
splice.c:45: warning: integer constant is too large for 'long' type
splice.c:46: warning: integer constant is too large for 'long' type
symlinkat.c: In function 'main':
symlinkat.c:12: warning: integer constant is too large for 'long' type
sync_file_range.c: In function 'main':
sync_file_range.c:42: warning: integer constant is too large for 'long' type
sync_file_range.c:43: warning: integer constant is too large for 'long' type
syslog.c: In function 'main':
syslog.c:14: warning: integer constant is too large for 'long' type
tee.c: In function 'main':
tee.c:41: warning: integer constant is too large for 'long' type
tee.c:42: warning: integer constant is too large for 'long' type
timer_create.c: In function 'main':
timer_create.c:52: warning: integer constant is too large for 'long' type
timer_create.c:84: warning: integer constant is too large for 'long' type
timer_create.c:85: warning: integer constant is too large for 'long' type
truncate64.c: In function 'main':
truncate64.c:41: warning: integer constant is too large for 'long' type
xgetrlimit.c: In function 'main':
xgetrlimit.c:71: warning: integer constant is too large for 'long' type
umode_t.c: In function 'test_syscall':
umode_t.c:46: warning: integer constant is too large for 'long' type
unlinkat.c: In function 'main':
unlinkat.c:13: warning: integer constant is too large for 'long' type
waitpid.c: In function 'main':
waitpid.c:43: warning: integer constant is too large for 'long' type
waitid.c: In function 'poison':
waitid.c:141: warning: integer constant is too large for 'long' type
xetpriority.c: In function 'main':
xetpriority.c:15: warning: integer constant is too large for 'long' type
xetpriority.c:19: warning: integer constant is too large for 'long' type
xetpriority.c:20: warning: integer constant is too large for 'long' type
xetpgid.c: In function 'main':
xetpgid.c:43: warning: integer constant is too large for 'long' type
xetpgid.c:47: warning: integer constant is too large for 'long' type
xetpgid.c:48: warning: integer constant is too large for 'long' type

(SLES 11SP4, i386)

* tests/alarm.c (main): Add proper suffix to integer constant.
* tests/aio.c (main): Likewise.
* tests/btrfs.c (btrfs_test_sync_ioctls, btrfs_test_subvol_ioctls): Likewise.
* tests/dup2.c (main): Likewise.
* tests/dup3.c (main): Likewise.
* tests/epoll_create.c (main): Likewise.
* tests/epoll_ctl.c (invoke_syscall): Likewise.
* tests/faccessat.c (main): Likewise.
* tests/fchdir.c (main): Likewise.
* tests/fcntl.c (test_flock64_einval): Likewise.
* tests/fcntl64.c (test_flock64_einval): Likewise.
* tests/fdatasync.c (main): Likewise.
* tests/flock.c (main): Likewise.
* tests/fstat64.c (SAMPLE_SIZE): Likewise.
* tests/fstat.c (SAMPLE_SIZE): Likewise.
* tests/fsync.c (main): Likewise.
* tests/ftruncate64.c (main): Likewise.
* tests/futimesat.c (main): Likewise.
* tests/get_mempolicy.c (main): Likewise.
* tests/getdents.c (main): Likewise.
* tests/getdents64.c (main): Likewise.
* tests/ioctl_block.c (lmagic, main): Likewise.
* tests/ioctl_evdev.c (lmagic): Likewise.
* tests/ioctl_mtd.c (lmagic): Likewise.
* tests/ioctl_rtc.c (lmagic): Likewise.
* tests/ioctl_v4l2.c (main): Likewise.
* tests/ioperm.c (main): Likewise.
* tests/ipc.c (ipc_call): Likewise.
* tests/kill.c (main): Likewise.
* tests/linkat.c (main): Likewise.
* tests/lstat64.c (SAMPLE_SIZE): Likewise.
* tests/lstat.c (SAMPLE_SIZE): Likewise.
* tests/mbind.c (main): Likewise.
* tests/migrate_pages.c (main): Likewise.
* tests/mkdirat.c (TEST_SYSCALL_PREFIX_ARGS): Likewise.
* tests/mknod.c (call_mknod, main): Likewise.
* tests/mknodat.c (fd, call_mknodat, main): Likewise.
* tests/mmap.c (main): Likewise.
* tests/move_pages.c (print_stat_pages, print_move_pages): Likewise.
* tests/mq_sendrecv.c (main): Likewise.
* tests/nsyscalls.c (test_syscall): Likewise.
* tests/prlimit64.c (main): Likewise.
* tests/remap_file_pages.c (main): Likewise.
* tests/renameat.c (main): Likewise.
* tests/rt_sigqueueinfo.c (main): Likewise.
* tests/rt_tgsigqueueinfo.c (k_tgsigqueueinfo, main): Likewise.
* tests/sendfile.c (main): Likewise.
* tests/sendfile64.c (main): Likewise.
* tests/set_mempolicy.c (main): Likewise.
* tests/setrlimit.c (main): Likewise.
* tests/socketcall.c (test_socketcall): Likewise.
* tests/splice.c (main): Likewise.
* tests/stat64.c (SAMPLE_SIZE): Likewise.
* tests/stat.c (SAMPLE_SIZE): Likewise.
* tests/struct_flock.c (invoke_test_syscall, test_flock_einval): Likewise.
* tests/symlinkat.c (main): Likewise.
* tests/sync_file_range.c (main): Likewise.
* tests/syslog.c (main): Likewise.
* tests/tee.c (main): Likewise.
* tests/timer_create.c (main): Likewise.
* tests/truncate64.c (main): Likewise.
* tests/umode_t.c (test_syscall): Likewise.
* tests/unlinkat.c (main): Likewise.
* tests/waitid.c (main): Likewise.
* tests/waitpid.c (main): Likewise.
* tests/xetpgid.c (main): Likewise.
* tests/xetpriority.c (main): Likewise.
* tests/xgetrlimit.c (main): Likewise.
* tests/xstatfsx.c (main) [CHECK_ODD_SIZE]: Likewise.
* tests/xstatx.c (main): Likewise.
2016-11-13 21:36:58 +00:00

523 lines
19 KiB
C

/*
* Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "tests.h"
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <linux/types.h>
#include <linux/videodev2.h>
static const unsigned int magic = 0xdeadbeef;
static void
init_magic(void *addr, const unsigned int size)
{
unsigned int *p = addr;
const unsigned int *end = addr + size;
for (; p < end; ++p)
*(unsigned int *) p = magic;
}
int
main(void )
{
const unsigned int size = get_page_size();
void *const page = tail_alloc(size);
init_magic(page, size);
const union u_pixel_format {
unsigned int pixelformat;
unsigned char cc[sizeof(int)];
} u = {
#if WORDS_BIGENDIAN
.cc = {
(unsigned char) (magic >> 24),
(unsigned char) (magic >> 16),
(unsigned char) (magic >> 8),
(unsigned char) magic
}
#else
.pixelformat = magic
#endif
};
/* VIDIOC_QUERYCAP */
ioctl(-1, VIDIOC_QUERYCAP, 0);
printf("ioctl(-1, VIDIOC_QUERYCAP, NULL) = -1 EBADF (%m)\n");
ioctl(-1, VIDIOC_QUERYCAP, page);
printf("ioctl(-1, VIDIOC_QUERYCAP, %p) = -1 EBADF (%m)\n", page);
/* VIDIOC_ENUM_FMT */
ioctl(-1, VIDIOC_ENUM_FMT, 0);
printf("ioctl(-1, VIDIOC_ENUM_FMT, NULL) = -1 EBADF (%m)\n");
struct v4l2_fmtdesc *const p_fmtdesc = tail_alloc(sizeof(*p_fmtdesc));
p_fmtdesc->index = magic;
p_fmtdesc->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
ioctl(-1, VIDIOC_ENUM_FMT, p_fmtdesc);
printf("ioctl(-1, VIDIOC_ENUM_FMT, {index=%u"
", type=V4L2_BUF_TYPE_VIDEO_CAPTURE}) = -1 EBADF (%m)\n", magic);
/* VIDIOC_G_FMT */
ioctl(-1, VIDIOC_G_FMT, 0);
printf("ioctl(-1, VIDIOC_G_FMT, NULL) = -1 EBADF (%m)\n");
struct v4l2_format *const p_format =
tail_alloc(sizeof(*p_format));
p_format->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
ioctl(-1, VIDIOC_G_FMT, p_format);
printf("ioctl(-1, VIDIOC_G_FMT"
", {type=V4L2_BUF_TYPE_VIDEO_CAPTURE}) = -1 EBADF (%m)\n");
/* VIDIOC_S_FMT */
ioctl(-1, VIDIOC_S_FMT, 0);
printf("ioctl(-1, VIDIOC_S_FMT, NULL) = -1 EBADF (%m)\n");
p_format->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
p_format->fmt.pix.width = 0xdad1beaf;
p_format->fmt.pix.height = 0xdad2beaf;
p_format->fmt.pix.pixelformat = 0xdeadbeef;
p_format->fmt.pix.field = V4L2_FIELD_NONE;
p_format->fmt.pix.bytesperline = 0xdad3beaf;
p_format->fmt.pix.sizeimage = 0xdad4beaf;
p_format->fmt.pix.colorspace = V4L2_COLORSPACE_JPEG;
ioctl(-1, VIDIOC_S_FMT, p_format);
printf("ioctl(-1, VIDIOC_S_FMT, {type=V4L2_BUF_TYPE_VIDEO_OUTPUT"
", fmt.pix={width=%u, height=%u, pixelformat="
"v4l2_fourcc('\\x%x', '\\x%x', '\\x%x', '\\x%x')"
", field=V4L2_FIELD_NONE, bytesperline=%u, sizeimage=%u"
", colorspace=V4L2_COLORSPACE_JPEG}}) = -1 EBADF (%m)\n",
p_format->fmt.pix.width, p_format->fmt.pix.height,
u.cc[0], u.cc[1], u.cc[2], u.cc[3],
p_format->fmt.pix.bytesperline, p_format->fmt.pix.sizeimage);
/* VIDIOC_TRY_FMT */
ioctl(-1, VIDIOC_TRY_FMT, 0);
printf("ioctl(-1, VIDIOC_TRY_FMT, NULL) = -1 EBADF (%m)\n");
#if HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE
memset(p_format, -1, sizeof(*p_format));
p_format->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
p_format->fmt.pix_mp.width = 0xdad1beaf;
p_format->fmt.pix_mp.height = 0xdad2beaf;
p_format->fmt.pix_mp.pixelformat = 0xdeadbeef;
p_format->fmt.pix_mp.field = V4L2_FIELD_NONE;
p_format->fmt.pix_mp.colorspace = V4L2_COLORSPACE_JPEG;
unsigned int i;
for (i = 0; i < ARRAY_SIZE(p_format->fmt.pix_mp.plane_fmt); ++i) {
p_format->fmt.pix_mp.plane_fmt[i].sizeimage = 0xbadc0de0 | i;
p_format->fmt.pix_mp.plane_fmt[i].bytesperline = 0xdadbeaf0 | i;
}
ioctl(-1, VIDIOC_TRY_FMT, p_format);
printf("ioctl(-1, VIDIOC_TRY_FMT"
", {type=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE"
", fmt.pix_mp={width=%u, height=%u, pixelformat="
"v4l2_fourcc('\\x%x', '\\x%x', '\\x%x', '\\x%x')"
", field=V4L2_FIELD_NONE, colorspace=V4L2_COLORSPACE_JPEG"
", plane_fmt=[",
p_format->fmt.pix_mp.width, p_format->fmt.pix_mp.height,
u.cc[0], u.cc[1], u.cc[2], u.cc[3]);
for (i = 0; i < ARRAY_SIZE(p_format->fmt.pix_mp.plane_fmt); ++i) {
if (i)
printf(", ");
printf("{sizeimage=%u, bytesperline=%u}",
p_format->fmt.pix_mp.plane_fmt[i].sizeimage,
p_format->fmt.pix_mp.plane_fmt[i].bytesperline);
}
printf("], num_planes=%u}}) = -1 EBADF (%m)\n",
p_format->fmt.pix_mp.num_planes);
#else
ioctl(-1, VIDIOC_TRY_FMT, page);
printf("ioctl(-1, VIDIOC_TRY_FMT, {type=%#x /* V4L2_BUF_TYPE_??? */})"
" = -1 EBADF (%m)\n", magic);
#endif
/* VIDIOC_REQBUFS */
ioctl(-1, VIDIOC_REQBUFS, 0);
printf("ioctl(-1, VIDIOC_REQBUFS, NULL) = -1 EBADF (%m)\n");
ioctl(-1, VIDIOC_REQBUFS,
page + size - sizeof(struct v4l2_requestbuffers));
printf("ioctl(-1, VIDIOC_REQBUFS, {count=%u, type=%#x"
" /* V4L2_BUF_TYPE_??? */, memory=%#x /* V4L2_MEMORY_??? */})"
" = -1 EBADF (%m)\n", magic, magic, magic);
/* VIDIOC_QUERYBUF */
ioctl(-1, VIDIOC_QUERYBUF, 0);
printf("ioctl(-1, VIDIOC_QUERYBUF, NULL) = -1 EBADF (%m)\n");
ioctl(-1, VIDIOC_QUERYBUF, page + size - sizeof(struct v4l2_buffer));
printf("ioctl(-1, VIDIOC_QUERYBUF, {type=%#x /* V4L2_BUF_TYPE_??? */"
", index=%u}) = -1 EBADF (%m)\n", magic, magic);
/* VIDIOC_QBUF */
ioctl(-1, VIDIOC_QBUF, 0);
printf("ioctl(-1, VIDIOC_QBUF, NULL) = -1 EBADF (%m)\n");
ioctl(-1, VIDIOC_QBUF, page + size - sizeof(struct v4l2_buffer));
printf("ioctl(-1, VIDIOC_QBUF, {type=%#x /* V4L2_BUF_TYPE_??? */"
", index=%u}) = -1 EBADF (%m)\n", magic, magic);
/* VIDIOC_DQBUF */
ioctl(-1, VIDIOC_DQBUF, 0);
printf("ioctl(-1, VIDIOC_DQBUF, NULL) = -1 EBADF (%m)\n");
ioctl(-1, VIDIOC_DQBUF, page + size - sizeof(struct v4l2_buffer));
printf("ioctl(-1, VIDIOC_DQBUF, {type=%#x"
" /* V4L2_BUF_TYPE_??? */}) = -1 EBADF (%m)\n", magic);
/* VIDIOC_G_FBUF */
ioctl(-1, VIDIOC_G_FBUF, 0);
printf("ioctl(-1, VIDIOC_G_FBUF, NULL) = -1 EBADF (%m)\n");
ioctl(-1, VIDIOC_G_FBUF, page);
printf("ioctl(-1, VIDIOC_G_FBUF, %p) = -1 EBADF (%m)\n", page);
/* VIDIOC_S_FBUF */
ioctl(-1, VIDIOC_S_FBUF, 0);
printf("ioctl(-1, VIDIOC_S_FBUF, NULL) = -1 EBADF (%m)\n");
ioctl(-1, VIDIOC_S_FBUF, page + size - sizeof(struct v4l2_framebuffer));
printf("ioctl(-1, VIDIOC_S_FBUF, {capability=%#x"
", flags=%#x, base=%#lx}) = -1 EBADF (%m)\n",
magic, magic, *(unsigned long *) page);
/* VIDIOC_STREAMON */
ioctl(-1, VIDIOC_STREAMON, 0);
printf("ioctl(-1, VIDIOC_STREAMON, NULL) = -1 EBADF (%m)\n");
ioctl(-1, VIDIOC_STREAMON, page + size - sizeof(int));
printf("ioctl(-1, VIDIOC_STREAMON, [%#x /* V4L2_BUF_TYPE_??? */])"
" = -1 EBADF (%m)\n", magic);
/* VIDIOC_STREAMOFF */
ioctl(-1, VIDIOC_STREAMOFF, 0);
printf("ioctl(-1, VIDIOC_STREAMOFF, NULL) = -1 EBADF (%m)\n");
ioctl(-1, VIDIOC_STREAMOFF, page + size - sizeof(int));
printf("ioctl(-1, VIDIOC_STREAMOFF, [%#x /* V4L2_BUF_TYPE_??? */])"
" = -1 EBADF (%m)\n", magic);
/* VIDIOC_G_PARM */
ioctl(-1, VIDIOC_G_PARM, 0);
printf("ioctl(-1, VIDIOC_G_PARM, NULL) = -1 EBADF (%m)\n");
ioctl(-1, VIDIOC_G_PARM, page + size - sizeof(struct v4l2_streamparm));
printf("ioctl(-1, VIDIOC_G_PARM, {type=%#x /* V4L2_BUF_TYPE_??? */})"
" = -1 EBADF (%m)\n", magic);
/* VIDIOC_S_PARM */
ioctl(-1, VIDIOC_S_PARM, 0);
printf("ioctl(-1, VIDIOC_S_PARM, NULL) = -1 EBADF (%m)\n");
ioctl(-1, VIDIOC_S_PARM, page);
printf("ioctl(-1, VIDIOC_S_PARM, {type=%#x /* V4L2_BUF_TYPE_??? */})"
" = -1 EBADF (%m)\n", magic);
struct v4l2_streamparm *const p_streamparm =
tail_alloc(sizeof(*p_streamparm));
p_streamparm->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
p_streamparm->parm.capture.capability = V4L2_CAP_TIMEPERFRAME;
p_streamparm->parm.capture.capturemode = V4L2_MODE_HIGHQUALITY;
p_streamparm->parm.capture.timeperframe.numerator = 0xdeadbeef;
p_streamparm->parm.capture.timeperframe.denominator = 0xbadc0ded;
ioctl(-1, VIDIOC_S_PARM, p_streamparm);
printf("ioctl(-1, VIDIOC_S_PARM, {type=V4L2_BUF_TYPE_VIDEO_CAPTURE"
", parm.capture={capability=V4L2_CAP_TIMEPERFRAME"
", capturemode=V4L2_MODE_HIGHQUALITY, timeperframe=%u/%u"
", extendedmode=%u, readbuffers=%u}}) = -1 EBADF (%m)\n",
p_streamparm->parm.capture.timeperframe.numerator,
p_streamparm->parm.capture.timeperframe.denominator, -1U, -1U);
p_streamparm->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
p_streamparm->parm.output.outputmode = 0;
ioctl(-1, VIDIOC_S_PARM, p_streamparm);
printf("ioctl(-1, VIDIOC_S_PARM, {type=V4L2_BUF_TYPE_VIDEO_OUTPUT"
", parm.output={capability=V4L2_CAP_TIMEPERFRAME"
", outputmode=0, timeperframe=%u/%u"
", extendedmode=%u, writebuffers=%u}}) = -1 EBADF (%m)\n",
p_streamparm->parm.output.timeperframe.numerator,
p_streamparm->parm.output.timeperframe.denominator, -1U, -1U);
/* VIDIOC_G_STD */
ioctl(-1, VIDIOC_G_STD, 0);
printf("ioctl(-1, VIDIOC_G_STD, NULL) = -1 EBADF (%m)\n");
ioctl(-1, VIDIOC_G_STD, page);
printf("ioctl(-1, VIDIOC_G_STD, %p) = -1 EBADF (%m)\n", page);
/* VIDIOC_S_STD */
ioctl(-1, VIDIOC_S_STD, 0);
printf("ioctl(-1, VIDIOC_S_STD, NULL) = -1 EBADF (%m)\n");
ioctl(-1, VIDIOC_S_STD, page + size - sizeof(long long));
printf("ioctl(-1, VIDIOC_S_STD, [%#llx]) = -1 EBADF (%m)\n",
*(unsigned long long *) page);
/* VIDIOC_ENUMSTD */
ioctl(-1, VIDIOC_ENUMSTD, 0);
printf("ioctl(-1, VIDIOC_ENUMSTD, NULL) = -1 EBADF (%m)\n");
struct v4l2_standard *const p_standard =
tail_alloc(sizeof(*p_standard));
p_standard->index = magic;
ioctl(-1, VIDIOC_ENUMSTD, p_standard);
printf("ioctl(-1, VIDIOC_ENUMSTD, {index=%u}) = -1 EBADF (%m)\n",
magic);
/* VIDIOC_ENUMINPUT */
ioctl(-1, VIDIOC_ENUMINPUT, 0);
printf("ioctl(-1, VIDIOC_ENUMINPUT, NULL) = -1 EBADF (%m)\n");
ioctl(-1, VIDIOC_ENUMINPUT, page);
printf("ioctl(-1, VIDIOC_ENUMINPUT, {index=%u}) = -1 EBADF (%m)\n",
magic);
/* VIDIOC_G_CTRL */
ioctl(-1, VIDIOC_G_CTRL, 0);
printf("ioctl(-1, VIDIOC_G_CTRL, NULL) = -1 EBADF (%m)\n");
ioctl(-1, VIDIOC_G_CTRL, page + size - sizeof(struct v4l2_control));
printf("ioctl(-1, VIDIOC_G_CTRL, {id=%#x /* V4L2_CID_??? */})"
" = -1 EBADF (%m)\n", magic);
/* VIDIOC_S_CTRL */
ioctl(-1, VIDIOC_S_CTRL, 0);
printf("ioctl(-1, VIDIOC_S_CTRL, NULL) = -1 EBADF (%m)\n");
ioctl(-1, VIDIOC_S_CTRL, page + size - sizeof(struct v4l2_control));
printf("ioctl(-1, VIDIOC_S_CTRL, {id=%#x /* V4L2_CID_??? */"
", value=%d}) = -1 EBADF (%m)\n", magic, magic);
/* VIDIOC_QUERYCTRL */
ioctl(-1, VIDIOC_QUERYCTRL, 0);
printf("ioctl(-1, VIDIOC_QUERYCTRL, NULL) = -1 EBADF (%m)\n");
ioctl(-1, VIDIOC_QUERYCTRL,
page + size - sizeof(struct v4l2_queryctrl));
# ifdef V4L2_CTRL_FLAG_NEXT_CTRL
printf("ioctl(-1, VIDIOC_QUERYCTRL, {id=V4L2_CTRL_FLAG_NEXT_CTRL"
"|%#x /* V4L2_CID_??? */}) = -1 EBADF (%m)\n",
magic & ~V4L2_CTRL_FLAG_NEXT_CTRL);
# else
printf("ioctl(-1, VIDIOC_QUERYCTRL, {id=%#x /* V4L2_CID_??? */})"
" = -1 EBADF (%m)\n", magic);
# endif
struct v4l2_queryctrl *const p_queryctrl =
tail_alloc(sizeof(*p_queryctrl));
p_queryctrl->id = V4L2_CID_SATURATION;
ioctl(-1, VIDIOC_QUERYCTRL, p_queryctrl);
printf("ioctl(-1, VIDIOC_QUERYCTRL, {id=V4L2_CID_SATURATION})"
" = -1 EBADF (%m)\n");
/* VIDIOC_G_INPUT */
ioctl(-1, VIDIOC_G_INPUT, 0);
printf("ioctl(-1, VIDIOC_G_INPUT, NULL) = -1 EBADF (%m)\n");
ioctl(-1, VIDIOC_G_INPUT, page);
printf("ioctl(-1, VIDIOC_G_INPUT, %p) = -1 EBADF (%m)\n", page);
/* VIDIOC_S_INPUT */
ioctl(-1, VIDIOC_S_INPUT, 0);
printf("ioctl(-1, VIDIOC_S_INPUT, NULL) = -1 EBADF (%m)\n");
ioctl(-1, VIDIOC_S_INPUT, page + size - sizeof(int));
printf("ioctl(-1, VIDIOC_S_INPUT, [%u]) = -1 EBADF (%m)\n", magic);
/* VIDIOC_CROPCAP */
ioctl(-1, VIDIOC_CROPCAP, 0);
printf("ioctl(-1, VIDIOC_CROPCAP, NULL) = -1 EBADF (%m)\n");
ioctl(-1, VIDIOC_CROPCAP, page + size - sizeof(struct v4l2_cropcap));
printf("ioctl(-1, VIDIOC_CROPCAP, {type=%#x /* V4L2_BUF_TYPE_??? */})"
" = -1 EBADF (%m)\n", magic);
/* VIDIOC_G_CROP */
ioctl(-1, VIDIOC_G_CROP, 0);
printf("ioctl(-1, VIDIOC_G_CROP, NULL) = -1 EBADF (%m)\n");
ioctl(-1, VIDIOC_G_CROP, page + size - sizeof(struct v4l2_crop));
printf("ioctl(-1, VIDIOC_G_CROP, {type=%#x /* V4L2_BUF_TYPE_??? */})"
" = -1 EBADF (%m)\n", magic);
/* VIDIOC_S_CROP */
ioctl(-1, VIDIOC_S_CROP, 0);
printf("ioctl(-1, VIDIOC_S_CROP, NULL) = -1 EBADF (%m)\n");
ioctl(-1, VIDIOC_S_CROP, page + size - sizeof(struct v4l2_crop));
printf("ioctl(-1, VIDIOC_S_CROP, {type=%#x /* V4L2_BUF_TYPE_??? */"
", c={left=%d, top=%d, width=%u, height=%u}}) = -1 EBADF (%m)\n",
magic, magic, magic, magic, magic);
#ifdef VIDIOC_S_EXT_CTRLS
/* VIDIOC_S_EXT_CTRLS */
ioctl(-1, VIDIOC_S_EXT_CTRLS, 0);
printf("ioctl(-1, VIDIOC_S_EXT_CTRLS, NULL) = -1 EBADF (%m)\n");
struct v4l2_ext_controls *const p_ext_controls =
tail_alloc(sizeof(*p_ext_controls));
p_ext_controls->ctrl_class = V4L2_CTRL_CLASS_USER;
p_ext_controls->count = 0;
p_ext_controls->controls = (void *) -2UL;
ioctl(-1, VIDIOC_S_EXT_CTRLS, p_ext_controls);
printf("ioctl(-1, VIDIOC_S_EXT_CTRLS, {ctrl_class=V4L2_CTRL_CLASS_USER"
", count=%u}) = -1 EBADF (%m)\n", p_ext_controls->count);
p_ext_controls->ctrl_class = V4L2_CTRL_CLASS_MPEG;
p_ext_controls->count = magic;
ioctl(-1, VIDIOC_S_EXT_CTRLS, p_ext_controls);
printf("ioctl(-1, VIDIOC_S_EXT_CTRLS, {ctrl_class=V4L2_CTRL_CLASS_MPEG"
", count=%u, controls=%p}) = -1 EBADF (%m)\n",
p_ext_controls->count, p_ext_controls->controls);
# if HAVE_DECL_V4L2_CTRL_TYPE_STRING
p_ext_controls->count = 2;
p_ext_controls->controls =
tail_alloc(sizeof(*p_ext_controls->controls) * p_ext_controls->count);
p_ext_controls->controls[0].id = V4L2_CID_BRIGHTNESS;
p_ext_controls->controls[0].size = 0;
p_ext_controls->controls[0].value64 = 0xfacefeeddeadbeefULL;
p_ext_controls->controls[1].id = V4L2_CID_CONTRAST;
p_ext_controls->controls[1].size = 2;
p_ext_controls->controls[1].string =
tail_alloc(p_ext_controls->controls[1].size);
ioctl(-1, VIDIOC_S_EXT_CTRLS, p_ext_controls);
printf("ioctl(-1, VIDIOC_S_EXT_CTRLS"
", {ctrl_class=V4L2_CTRL_CLASS_MPEG, count=%u, controls="
"[{id=V4L2_CID_BRIGHTNESS, size=0, value=%d, value64=%lld}"
", {id=V4L2_CID_CONTRAST, size=2, string=\"\\377\\377\"}"
"] => controls="
"[{id=V4L2_CID_BRIGHTNESS, size=0, value=%d, value64=%lld}"
", {id=V4L2_CID_CONTRAST, size=2, string=\"\\377\\377\"}"
"], error_idx=%u}) = -1 EBADF (%m)\n",
p_ext_controls->count,
p_ext_controls->controls[0].value,
(long long) p_ext_controls->controls[0].value64,
p_ext_controls->controls[0].value,
(long long) p_ext_controls->controls[0].value64,
p_ext_controls->error_idx);
++p_ext_controls->count;
ioctl(-1, VIDIOC_S_EXT_CTRLS, p_ext_controls);
printf("ioctl(-1, VIDIOC_S_EXT_CTRLS"
", {ctrl_class=V4L2_CTRL_CLASS_MPEG, count=%u, controls="
"[{id=V4L2_CID_BRIGHTNESS, size=0, value=%d, value64=%lld}"
", {id=V4L2_CID_CONTRAST, size=2, string=\"\\377\\377\"}"
", %p]}) = -1 EBADF (%m)\n",
p_ext_controls->count,
p_ext_controls->controls[0].value,
(long long) p_ext_controls->controls[0].value64,
p_ext_controls->controls + 2);
# endif /* HAVE_DECL_V4L2_CTRL_TYPE_STRING */
/* VIDIOC_TRY_EXT_CTRLS */
ioctl(-1, VIDIOC_TRY_EXT_CTRLS, 0);
printf("ioctl(-1, VIDIOC_TRY_EXT_CTRLS, NULL) = -1 EBADF (%m)\n");
p_ext_controls->ctrl_class = V4L2_CTRL_CLASS_USER;
p_ext_controls->count = magic;
p_ext_controls->controls = (void *) -2UL;
ioctl(-1, VIDIOC_TRY_EXT_CTRLS, p_ext_controls);
printf("ioctl(-1, VIDIOC_TRY_EXT_CTRLS"
", {ctrl_class=V4L2_CTRL_CLASS_USER, count=%u, controls=%p})"
" = -1 EBADF (%m)\n",
p_ext_controls->count, p_ext_controls->controls);
/* VIDIOC_G_EXT_CTRLS */
ioctl(-1, VIDIOC_G_EXT_CTRLS, 0);
printf("ioctl(-1, VIDIOC_G_EXT_CTRLS, NULL) = -1 EBADF (%m)\n");
ioctl(-1, VIDIOC_G_EXT_CTRLS, p_ext_controls);
printf("ioctl(-1, VIDIOC_G_EXT_CTRLS"
", {ctrl_class=V4L2_CTRL_CLASS_USER, count=%u, controls=%p"
", error_idx=%u}) = -1 EBADF (%m)\n",
p_ext_controls->count, p_ext_controls->controls,
p_ext_controls->error_idx);
#endif /* VIDIOC_S_EXT_CTRLS */
#ifdef VIDIOC_ENUM_FRAMESIZES
ioctl(-1, VIDIOC_ENUM_FRAMESIZES, 0);
printf("ioctl(-1, VIDIOC_ENUM_FRAMESIZES, NULL) = -1 EBADF (%m)\n");
struct v4l2_frmsizeenum *const p_frmsizeenum =
tail_alloc(sizeof(*p_frmsizeenum));
p_frmsizeenum->index = magic;
const union u_pixel_format u_frmsizeenum = {
.cc = { 'A', '\'', '\\', '\xfa' }
};
#if WORDS_BIGENDIAN
p_frmsizeenum->pixel_format =
(unsigned) u_frmsizeenum.cc[0] << 24 |
(unsigned) u_frmsizeenum.cc[1] << 16 |
(unsigned) u_frmsizeenum.cc[2] << 8 |
(unsigned) u_frmsizeenum.cc[3];
#else
p_frmsizeenum->pixel_format = u_frmsizeenum.pixelformat;
#endif
ioctl(-1, VIDIOC_ENUM_FRAMESIZES, p_frmsizeenum);
printf("ioctl(-1, VIDIOC_ENUM_FRAMESIZES, {index=%u"
", pixel_format=v4l2_fourcc('%c', '\\%c', '\\%c', '\\x%x')})"
" = -1 EBADF (%m)\n", p_frmsizeenum->index,
u_frmsizeenum.cc[0], u_frmsizeenum.cc[1],
u_frmsizeenum.cc[2], u_frmsizeenum.cc[3]);
#endif /* VIDIOC_ENUM_FRAMESIZES */
#ifdef VIDIOC_ENUM_FRAMEINTERVALS
ioctl(-1, VIDIOC_ENUM_FRAMEINTERVALS, 0);
printf("ioctl(-1, VIDIOC_ENUM_FRAMEINTERVALS, NULL) = -1 EBADF (%m)\n");
ioctl(-1, VIDIOC_ENUM_FRAMEINTERVALS, page);
printf("ioctl(-1, VIDIOC_ENUM_FRAMEINTERVALS, {index=%u"
", pixel_format=v4l2_fourcc('\\x%x', '\\x%x', '\\x%x', '\\x%x')"
", width=%u, height=%u}) = -1 EBADF (%m)\n",
magic, u.cc[0], u.cc[1], u.cc[2], u.cc[3], magic, magic);
#endif /* VIDIOC_ENUM_FRAMEINTERVALS */
#ifdef VIDIOC_CREATE_BUFS
ioctl(-1, VIDIOC_CREATE_BUFS, 0);
printf("ioctl(-1, VIDIOC_CREATE_BUFS, NULL) = -1 EBADF (%m)\n");
ioctl(-1, VIDIOC_CREATE_BUFS,
page + size - sizeof(struct v4l2_create_buffers));
printf("ioctl(-1, VIDIOC_CREATE_BUFS, {count=%u, memory=%#x"
" /* V4L2_MEMORY_??? */, format={type=%#x"
" /* V4L2_BUF_TYPE_??? */}}) = -1 EBADF (%m)\n",
magic, magic, magic);
#endif /* VIDIOC_CREATE_BUFS */
puts("+++ exited with 0 +++");
return 0;
}