xref: /OK3568_Linux_fs/kernel/Documentation/userspace-api/media/dvb/dmx-querybuf.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2*4882a593Smuzhiyun.. c:namespace:: DTV.dmx
3*4882a593Smuzhiyun
4*4882a593Smuzhiyun.. _DMX_QUERYBUF:
5*4882a593Smuzhiyun
6*4882a593Smuzhiyun******************
7*4882a593Smuzhiyunioctl DMX_QUERYBUF
8*4882a593Smuzhiyun******************
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunName
11*4882a593Smuzhiyun====
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunDMX_QUERYBUF - Query the status of a buffer
14*4882a593Smuzhiyun
15*4882a593Smuzhiyun.. warning:: this API is still experimental
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunSynopsis
18*4882a593Smuzhiyun========
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun.. c:macro:: DMX_QUERYBUF
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun``int ioctl(int fd, DMX_QUERYBUF, struct dvb_buffer *argp)``
23*4882a593Smuzhiyun
24*4882a593SmuzhiyunArguments
25*4882a593Smuzhiyun=========
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun``fd``
28*4882a593Smuzhiyun    File descriptor returned by :c:func:`open()`.
29*4882a593Smuzhiyun
30*4882a593Smuzhiyun``argp``
31*4882a593Smuzhiyun    Pointer to struct :c:type:`dvb_buffer`.
32*4882a593Smuzhiyun
33*4882a593SmuzhiyunDescription
34*4882a593Smuzhiyun===========
35*4882a593Smuzhiyun
36*4882a593SmuzhiyunThis ioctl is part of the mmap streaming I/O method. It can
37*4882a593Smuzhiyunbe used to query the status of a buffer at any time after buffers have
38*4882a593Smuzhiyunbeen allocated with the :ref:`DMX_REQBUFS` ioctl.
39*4882a593Smuzhiyun
40*4882a593SmuzhiyunApplications set the ``index`` field. Valid index numbers range from zero
41*4882a593Smuzhiyunto the number of buffers allocated with :ref:`DMX_REQBUFS`
42*4882a593Smuzhiyun(struct :c:type:`dvb_requestbuffers` ``count``) minus one.
43*4882a593Smuzhiyun
44*4882a593SmuzhiyunAfter calling :ref:`DMX_QUERYBUF` with a pointer to this structure,
45*4882a593Smuzhiyundrivers return an error code or fill the rest of the structure.
46*4882a593Smuzhiyun
47*4882a593SmuzhiyunOn success, the ``offset`` will contain the offset of the buffer from the
48*4882a593Smuzhiyunstart of the device memory, the ``length`` field its size, and the
49*4882a593Smuzhiyun``bytesused`` the number of bytes occupied by data in the buffer (payload).
50*4882a593Smuzhiyun
51*4882a593SmuzhiyunReturn Value
52*4882a593Smuzhiyun============
53*4882a593Smuzhiyun
54*4882a593SmuzhiyunOn success 0 is returned, the ``offset`` will contain the offset of the
55*4882a593Smuzhiyunbuffer from the start of the device memory, the ``length`` field its size,
56*4882a593Smuzhiyunand the ``bytesused`` the number of bytes occupied by data in the buffer
57*4882a593Smuzhiyun(payload).
58*4882a593Smuzhiyun
59*4882a593SmuzhiyunOn error it returns -1 and the ``errno`` variable is set
60*4882a593Smuzhiyunappropriately. The generic error codes are described at the
61*4882a593Smuzhiyun:ref:`Generic Error Codes <gen-errors>` chapter.
62*4882a593Smuzhiyun
63*4882a593SmuzhiyunEINVAL
64*4882a593Smuzhiyun    The ``index`` is out of bounds.
65