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