18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 28c2ecf20Sopenharmony_ci.. c:namespace:: DTV.dmx 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci.. _DMX_QUERYBUF: 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci****************** 78c2ecf20Sopenharmony_ciioctl DMX_QUERYBUF 88c2ecf20Sopenharmony_ci****************** 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ciName 118c2ecf20Sopenharmony_ci==== 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ciDMX_QUERYBUF - Query the status of a buffer 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci.. warning:: this API is still experimental 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ciSynopsis 188c2ecf20Sopenharmony_ci======== 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci.. c:macro:: DMX_QUERYBUF 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci``int ioctl(int fd, DMX_QUERYBUF, struct dvb_buffer *argp)`` 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ciArguments 258c2ecf20Sopenharmony_ci========= 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci``fd`` 288c2ecf20Sopenharmony_ci File descriptor returned by :c:func:`open()`. 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci``argp`` 318c2ecf20Sopenharmony_ci Pointer to struct :c:type:`dvb_buffer`. 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ciDescription 348c2ecf20Sopenharmony_ci=========== 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ciThis ioctl is part of the mmap streaming I/O method. It can 378c2ecf20Sopenharmony_cibe used to query the status of a buffer at any time after buffers have 388c2ecf20Sopenharmony_cibeen allocated with the :ref:`DMX_REQBUFS` ioctl. 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ciApplications set the ``index`` field. Valid index numbers range from zero 418c2ecf20Sopenharmony_cito the number of buffers allocated with :ref:`DMX_REQBUFS` 428c2ecf20Sopenharmony_ci(struct :c:type:`dvb_requestbuffers` ``count``) minus one. 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ciAfter calling :ref:`DMX_QUERYBUF` with a pointer to this structure, 458c2ecf20Sopenharmony_cidrivers return an error code or fill the rest of the structure. 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ciOn success, the ``offset`` will contain the offset of the buffer from the 488c2ecf20Sopenharmony_cistart of the device memory, the ``length`` field its size, and the 498c2ecf20Sopenharmony_ci``bytesused`` the number of bytes occupied by data in the buffer (payload). 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ciReturn Value 528c2ecf20Sopenharmony_ci============ 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ciOn success 0 is returned, the ``offset`` will contain the offset of the 558c2ecf20Sopenharmony_cibuffer from the start of the device memory, the ``length`` field its size, 568c2ecf20Sopenharmony_ciand the ``bytesused`` the number of bytes occupied by data in the buffer 578c2ecf20Sopenharmony_ci(payload). 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ciOn error it returns -1 and the ``errno`` variable is set 608c2ecf20Sopenharmony_ciappropriately. The generic error codes are described at the 618c2ecf20Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter. 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ciEINVAL 648c2ecf20Sopenharmony_ci The ``index`` is out of bounds. 65