Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[sfrench/cifs-2.6.git] / Documentation / media / uapi / cec / cec-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 .. _cec-func-ioctl:
11
12 ***********
13 cec ioctl()
14 ***********
15
16 Name
17 ====
18
19 cec-ioctl - Control a cec device
20
21 Synopsis
22 ========
23
24 .. code-block:: c
25
26     #include <sys/ioctl.h>
27
28
29 .. c:function:: int ioctl( int fd, int request, void *argp )
30    :name: cec-ioctl
31
32 Arguments
33 =========
34
35 ``fd``
36     File descriptor returned by :c:func:`open() <cec-open>`.
37
38 ``request``
39     CEC ioctl request code as defined in the cec.h header file, for
40     example :ref:`CEC_ADAP_G_CAPS <CEC_ADAP_G_CAPS>`.
41
42 ``argp``
43     Pointer to a request-specific structure.
44
45
46 Description
47 ===========
48
49 The :c:func:`ioctl() <cec-ioctl>` function manipulates cec device parameters. The
50 argument ``fd`` must be an open file descriptor.
51
52 The ioctl ``request`` code specifies the cec function to be called. It
53 has encoded in it whether the argument is an input, output or read/write
54 parameter, and the size of the argument ``argp`` in bytes.
55
56 Macros and structures definitions specifying cec ioctl requests and
57 their parameters are located in the cec.h header file. All cec ioctl
58 requests, their respective function and parameters are specified in
59 :ref:`cec-user-func`.
60
61
62 Return Value
63 ============
64
65 On success 0 is returned, on error -1 and the ``errno`` variable is set
66 appropriately. The generic error codes are described at the
67 :ref:`Generic Error Codes <gen-errors>` chapter.
68
69 Request-specific error codes are listed in the individual requests
70 descriptions.
71
72 When an ioctl that takes an output or read/write parameter fails, the
73 parameter remains unmodified.