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