Merge branch 'next-seccomp' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
[sfrench/cifs-2.6.git] / Documentation / media / uapi / v4l / func-ioctl.rst
1 .. Permission is granted to copy, distribute and/or modify this
2 .. document under the terms of the GNU Free Documentation License,
3 .. Version 1.1 or any later version published by the Free Software
4 .. Foundation, with no Invariant Sections, no Front-Cover Texts
5 .. and no Back-Cover Texts. A copy of the license is included at
6 .. Documentation/media/uapi/fdl-appendix.rst.
7 ..
8 .. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
9
10 .. _func-ioctl:
11
12 ************
13 V4L2 ioctl()
14 ************
15
16 Name
17 ====
18
19 v4l2-ioctl - Program a V4L2 device
20
21
22 Synopsis
23 ========
24
25 .. code-block:: c
26
27     #include <sys/ioctl.h>
28
29
30 .. c:function:: int ioctl( int fd, int request, void *argp )
31     :name: v4l2-ioctl
32
33 Arguments
34 =========
35
36 ``fd``
37     File descriptor returned by :ref:`open() <func-open>`.
38
39 ``request``
40     V4L2 ioctl request code as defined in the ``videodev2.h`` header
41     file, for example VIDIOC_QUERYCAP.
42
43 ``argp``
44     Pointer to a function parameter, usually a structure.
45
46
47 Description
48 ===========
49
50 The :ref:`ioctl() <func-ioctl>` function is used to program V4L2 devices. The
51 argument ``fd`` must be an open file descriptor. An ioctl ``request``
52 has encoded in it whether the argument is an input, output or read/write
53 parameter, and the size of the argument ``argp`` in bytes. Macros and
54 defines specifying V4L2 ioctl requests are located in the
55 ``videodev2.h`` header file. Applications should use their own copy, not
56 include the version in the kernel sources on the system they compile on.
57 All V4L2 ioctl requests, their respective function and parameters are
58 specified in :ref:`user-func`.
59
60
61 Return Value
62 ============
63
64 On success 0 is returned, on error -1 and the ``errno`` variable is set
65 appropriately. The generic error codes are described at the
66 :ref:`Generic Error Codes <gen-errors>` chapter.
67
68 When an ioctl that takes an output or read/write parameter fails, the
69 parameter remains unmodified.