1 .. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-or-later WITH no-invariant-sections
3 .. _media_ioc_request_alloc:
5 *****************************
6 ioctl MEDIA_IOC_REQUEST_ALLOC
7 *****************************
12 MEDIA_IOC_REQUEST_ALLOC - Allocate a request
18 .. c:function:: int ioctl( int fd, MEDIA_IOC_REQUEST_ALLOC, int *argp )
19 :name: MEDIA_IOC_REQUEST_ALLOC
26 File descriptor returned by :ref:`open() <media-func-open>`.
29 Pointer to an integer.
35 If the media device supports :ref:`requests <media-request-api>`, then
36 this ioctl can be used to allocate a request. If it is not supported, then
37 ``errno`` is set to ``ENOTTY``. A request is accessed through a file descriptor
38 that is returned in ``*argp``.
40 If the request was successfully allocated, then the request file descriptor
41 can be passed to the :ref:`VIDIOC_QBUF <VIDIOC_QBUF>`,
42 :ref:`VIDIOC_G_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>`,
43 :ref:`VIDIOC_S_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` and
44 :ref:`VIDIOC_TRY_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` ioctls.
46 In addition, the request can be queued by calling
47 :ref:`MEDIA_REQUEST_IOC_QUEUE` and re-initialized by calling
48 :ref:`MEDIA_REQUEST_IOC_REINIT`.
50 Finally, the file descriptor can be :ref:`polled <request-func-poll>` to wait
51 for the request to complete.
53 The request will remain allocated until all the file descriptors associated
54 with it are closed by :ref:`close() <request-func-close>` and the driver no
55 longer uses the request internally. See also
56 :ref:`here <media-request-life-time>` for more information.
61 On success 0 is returned, on error -1 and the ``errno`` variable is set
62 appropriately. The generic error codes are described at the
63 :ref:`Generic Error Codes <gen-errors>` chapter.
66 The driver has no support for requests.