GNU Linux-libre 4.19.286-gnu1
[releases.git] / Documentation / media / uapi / dvb / dmx-querybuf.rst
1 .. _DMX_QUERYBUF:
2
3 ******************
4 ioctl DMX_QUERYBUF
5 ******************
6
7 Name
8 ====
9
10 DMX_QUERYBUF - Query the status of a buffer
11
12 .. warning:: this API is still experimental
13
14
15 Synopsis
16 ========
17
18 .. c:function:: int ioctl( int fd, DMX_QUERYBUF, struct dvb_buffer *argp )
19     :name: DMX_QUERYBUF
20
21
22 Arguments
23 =========
24
25 ``fd``
26     File descriptor returned by :ref:`open() <dmx_fopen>`.
27
28 ``argp``
29     Pointer to struct :c:type:`dvb_buffer`.
30
31
32 Description
33 ===========
34
35 This ioctl is part of the mmap streaming I/O method. It can
36 be used to query the status of a buffer at any time after buffers have
37 been allocated with the :ref:`DMX_REQBUFS` ioctl.
38
39 Applications set the ``index`` field. Valid index numbers range from zero
40 to the number of buffers allocated with :ref:`DMX_REQBUFS`
41 (struct :c:type:`dvb_requestbuffers` ``count``) minus one.
42
43 After calling :ref:`DMX_QUERYBUF` with a pointer to this structure,
44 drivers return an error code or fill the rest of the structure.
45
46 On success, the ``offset`` will contain the offset of the buffer from the
47 start of the device memory, the ``length`` field its size, and the
48 ``bytesused`` the number of bytes occupied by data in the buffer (payload).
49
50 Return Value
51 ============
52
53 On success 0 is returned, the ``offset`` will contain the offset of the
54 buffer from the start of the device memory, the ``length`` field its size,
55 and the ``bytesused`` the number of bytes occupied by data in the buffer
56 (payload).
57
58 On error it returns -1 and the ``errno`` variable is set
59 appropriately. The generic error codes are described at the
60 :ref:`Generic Error Codes <gen-errors>` chapter.
61
62 EINVAL
63     The ``index`` is out of bounds.