dmx-querybuf.rst 1.7 KB

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