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