0001 .. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-no-invariants-or-later
0002 .. c:namespace:: MC
0003
0004 .. _request-func-ioctl:
0005
0006 ***************
0007 request ioctl()
0008 ***************
0009
0010 Name
0011 ====
0012
0013 request-ioctl - Control a request file descriptor
0014
0015 Synopsis
0016 ========
0017
0018 .. code-block:: c
0019
0020 #include <sys/ioctl.h>
0021
0022 ``int ioctl(int fd, int cmd, void *argp)``
0023
0024 Arguments
0025 =========
0026
0027 ``fd``
0028 File descriptor returned by :ref:`MEDIA_IOC_REQUEST_ALLOC`.
0029
0030 ``cmd``
0031 The request ioctl command code as defined in the media.h header file, for
0032 example :ref:`MEDIA_REQUEST_IOC_QUEUE`.
0033
0034 ``argp``
0035 Pointer to a request-specific structure.
0036
0037 Description
0038 ===========
0039
0040 The :ref:`ioctl() <request-func-ioctl>` function manipulates request
0041 parameters. The argument ``fd`` must be an open file descriptor.
0042
0043 The ioctl ``cmd`` code specifies the request function to be called. It
0044 has encoded in it whether the argument is an input, output or read/write
0045 parameter, and the size of the argument ``argp`` in bytes.
0046
0047 Macros and structures definitions specifying request ioctl commands and
0048 their parameters are located in the media.h header file. All request ioctl
0049 commands, their respective function and parameters are specified in
0050 :ref:`media-user-func`.
0051
0052 Return Value
0053 ============
0054
0055 On success 0 is returned, on error -1 and the ``errno`` variable is set
0056 appropriately. The generic error codes are described at the
0057 :ref:`Generic Error Codes <gen-errors>` chapter.
0058
0059 Command-specific error codes are listed in the individual command
0060 descriptions.
0061
0062 When an ioctl that takes an output or read/write parameter fails, the
0063 parameter remains unmodified.