Merge branch 'for-4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/dennis/percpu
[sfrench/cifs-2.6.git] / Documentation / media / uapi / dvb / dmx-querybuf.rst
1 .. Permission is granted to copy, distribute and/or modify this
2 .. document under the terms of the GNU Free Documentation License,
3 .. Version 1.1 or any later version published by the Free Software
4 .. Foundation, with no Invariant Sections, no Front-Cover Texts
5 .. and no Back-Cover Texts. A copy of the license is included at
6 .. Documentation/media/uapi/fdl-appendix.rst.
7 ..
8 .. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
9
10 .. _DMX_QUERYBUF:
11
12 ******************
13 ioctl DMX_QUERYBUF
14 ******************
15
16 Name
17 ====
18
19 DMX_QUERYBUF - Query the status of a buffer
20
21 .. warning:: this API is still experimental
22
23
24 Synopsis
25 ========
26
27 .. c:function:: int ioctl( int fd, DMX_QUERYBUF, struct dvb_buffer *argp )
28     :name: DMX_QUERYBUF
29
30
31 Arguments
32 =========
33
34 ``fd``
35     File descriptor returned by :ref:`open() <dmx_fopen>`.
36
37 ``argp``
38     Pointer to struct :c:type:`dvb_buffer`.
39
40
41 Description
42 ===========
43
44 This ioctl is part of the mmap streaming I/O method. It can
45 be used to query the status of a buffer at any time after buffers have
46 been allocated with the :ref:`DMX_REQBUFS` ioctl.
47
48 Applications set the ``index`` field. Valid index numbers range from zero
49 to the number of buffers allocated with :ref:`DMX_REQBUFS`
50 (struct :c:type:`dvb_requestbuffers` ``count``) minus one.
51
52 After calling :ref:`DMX_QUERYBUF` with a pointer to this structure,
53 drivers return an error code or fill the rest of the structure.
54
55 On success, the ``offset`` will contain the offset of the buffer from the
56 start of the device memory, the ``length`` field its size, and the
57 ``bytesused`` the number of bytes occupied by data in the buffer (payload).
58
59 Return Value
60 ============
61
62 On success 0 is returned, the ``offset`` will contain the offset of the
63 buffer from the start of the device memory, the ``length`` field its size,
64 and the ``bytesused`` the number of bytes occupied by data in the buffer
65 (payload).
66
67 On error it returns -1 and the ``errno`` variable is set
68 appropriately. The generic error codes are described at the
69 :ref:`Generic Error Codes <gen-errors>` chapter.
70
71 EINVAL
72     The ``index`` is out of bounds.