0001 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
0002 .. c:namespace:: DTV.dmx
0003
0004 .. _DMX_QUERYBUF:
0005
0006 ******************
0007 ioctl DMX_QUERYBUF
0008 ******************
0009
0010 Name
0011 ====
0012
0013 DMX_QUERYBUF - Query the status of a buffer
0014
0015 .. warning:: this API is still experimental
0016
0017 Synopsis
0018 ========
0019
0020 .. c:macro:: DMX_QUERYBUF
0021
0022 ``int ioctl(int fd, DMX_QUERYBUF, struct dvb_buffer *argp)``
0023
0024 Arguments
0025 =========
0026
0027 ``fd``
0028 File descriptor returned by :c:func:`open()`.
0029
0030 ``argp``
0031 Pointer to struct :c:type:`dvb_buffer`.
0032
0033 Description
0034 ===========
0035
0036 This ioctl is part of the mmap streaming I/O method. It can
0037 be used to query the status of a buffer at any time after buffers have
0038 been allocated with the :ref:`DMX_REQBUFS` ioctl.
0039
0040 Applications set the ``index`` field. Valid index numbers range from zero
0041 to the number of buffers allocated with :ref:`DMX_REQBUFS`
0042 (struct :c:type:`dvb_requestbuffers` ``count``) minus one.
0043
0044 After calling :ref:`DMX_QUERYBUF` with a pointer to this structure,
0045 drivers return an error code or fill the rest of the structure.
0046
0047 On success, the ``offset`` will contain the offset of the buffer from the
0048 start of the device memory, the ``length`` field its size, and the
0049 ``bytesused`` the number of bytes occupied by data in the buffer (payload).
0050
0051 Return Value
0052 ============
0053
0054 On success 0 is returned, the ``offset`` will contain the offset of the
0055 buffer from the start of the device memory, the ``length`` field its size,
0056 and the ``bytesused`` the number of bytes occupied by data in the buffer
0057 (payload).
0058
0059 On error it returns -1 and the ``errno`` variable is set
0060 appropriately. The generic error codes are described at the
0061 :ref:`Generic Error Codes <gen-errors>` chapter.
0062
0063 EINVAL
0064 The ``index`` is out of bounds.