1.. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-no-invariants-or-later
2.. c:namespace:: MC
3
4.. _media_ioc_request_alloc:
5
6*****************************
7ioctl MEDIA_IOC_REQUEST_ALLOC
8*****************************
9
10Name
11====
12
13MEDIA_IOC_REQUEST_ALLOC - Allocate a request
14
15Synopsis
16========
17
18.. c:macro:: MEDIA_IOC_REQUEST_ALLOC
19
20``int ioctl(int fd, MEDIA_IOC_REQUEST_ALLOC, int *argp)``
21
22Arguments
23=========
24
25``fd``
26    File descriptor returned by :c:func:`open()`.
27
28``argp``
29    Pointer to an integer.
30
31Description
32===========
33
34If the media device supports :ref:`requests <media-request-api>`, then
35this 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
37that is returned in ``*argp``.
38
39If the request was successfully allocated, then the request file descriptor
40can 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.
44
45In 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`.
48
49Finally, the file descriptor can be :ref:`polled <request-func-poll>` to wait
50for the request to complete.
51
52The request will remain allocated until all the file descriptors associated
53with it are closed by :c:func:`close()` and the driver no
54longer uses the request internally. See also
55:ref:`here <media-request-life-time>` for more information.
56
57Return Value
58============
59
60On success 0 is returned, on error -1 and the ``errno`` variable is set
61appropriately. The generic error codes are described at the
62:ref:`Generic Error Codes <gen-errors>` chapter.
63
64ENOTTY
65    The driver has no support for requests.
66