1059b1c5bSMauro Carvalho Chehab.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 2*f9b2e8aaSMauro Carvalho Chehab.. c:namespace:: DTV.dmx 354f38fcaSMauro Carvalho Chehab 454f38fcaSMauro Carvalho Chehab.. _DMX_QUERYBUF: 554f38fcaSMauro Carvalho Chehab 654f38fcaSMauro Carvalho Chehab****************** 754f38fcaSMauro Carvalho Chehabioctl DMX_QUERYBUF 854f38fcaSMauro Carvalho Chehab****************** 954f38fcaSMauro Carvalho Chehab 1054f38fcaSMauro Carvalho ChehabName 1154f38fcaSMauro Carvalho Chehab==== 1254f38fcaSMauro Carvalho Chehab 1354f38fcaSMauro Carvalho ChehabDMX_QUERYBUF - Query the status of a buffer 1454f38fcaSMauro Carvalho Chehab 1554f38fcaSMauro Carvalho Chehab.. warning:: this API is still experimental 1654f38fcaSMauro Carvalho Chehab 1754f38fcaSMauro Carvalho ChehabSynopsis 1854f38fcaSMauro Carvalho Chehab======== 1954f38fcaSMauro Carvalho Chehab 20*f9b2e8aaSMauro Carvalho Chehab.. c:macro:: DMX_QUERYBUF 2154f38fcaSMauro Carvalho Chehab 22*f9b2e8aaSMauro Carvalho Chehab``int ioctl(int fd, DMX_QUERYBUF, struct dvb_buffer *argp)`` 2354f38fcaSMauro Carvalho Chehab 2454f38fcaSMauro Carvalho ChehabArguments 2554f38fcaSMauro Carvalho Chehab========= 2654f38fcaSMauro Carvalho Chehab 2754f38fcaSMauro Carvalho Chehab``fd`` 28*f9b2e8aaSMauro Carvalho Chehab File descriptor returned by :c:func:`open()`. 2954f38fcaSMauro Carvalho Chehab 3054f38fcaSMauro Carvalho Chehab``argp`` 3154f38fcaSMauro Carvalho Chehab Pointer to struct :c:type:`dvb_buffer`. 3254f38fcaSMauro Carvalho Chehab 3354f38fcaSMauro Carvalho ChehabDescription 3454f38fcaSMauro Carvalho Chehab=========== 3554f38fcaSMauro Carvalho Chehab 3654f38fcaSMauro Carvalho ChehabThis ioctl is part of the mmap streaming I/O method. It can 3754f38fcaSMauro Carvalho Chehabbe used to query the status of a buffer at any time after buffers have 3854f38fcaSMauro Carvalho Chehabbeen allocated with the :ref:`DMX_REQBUFS` ioctl. 3954f38fcaSMauro Carvalho Chehab 4054f38fcaSMauro Carvalho ChehabApplications set the ``index`` field. Valid index numbers range from zero 4154f38fcaSMauro Carvalho Chehabto the number of buffers allocated with :ref:`DMX_REQBUFS` 4254f38fcaSMauro Carvalho Chehab(struct :c:type:`dvb_requestbuffers` ``count``) minus one. 4354f38fcaSMauro Carvalho Chehab 4454f38fcaSMauro Carvalho ChehabAfter calling :ref:`DMX_QUERYBUF` with a pointer to this structure, 4554f38fcaSMauro Carvalho Chehabdrivers return an error code or fill the rest of the structure. 4654f38fcaSMauro Carvalho Chehab 4754f38fcaSMauro Carvalho ChehabOn success, the ``offset`` will contain the offset of the buffer from the 4854f38fcaSMauro Carvalho Chehabstart of the device memory, the ``length`` field its size, and the 4954f38fcaSMauro Carvalho Chehab``bytesused`` the number of bytes occupied by data in the buffer (payload). 5054f38fcaSMauro Carvalho Chehab 5154f38fcaSMauro Carvalho ChehabReturn Value 5254f38fcaSMauro Carvalho Chehab============ 5354f38fcaSMauro Carvalho Chehab 5454f38fcaSMauro Carvalho ChehabOn success 0 is returned, the ``offset`` will contain the offset of the 5554f38fcaSMauro Carvalho Chehabbuffer from the start of the device memory, the ``length`` field its size, 5654f38fcaSMauro Carvalho Chehaband the ``bytesused`` the number of bytes occupied by data in the buffer 5754f38fcaSMauro Carvalho Chehab(payload). 5854f38fcaSMauro Carvalho Chehab 5954f38fcaSMauro Carvalho ChehabOn error it returns -1 and the ``errno`` variable is set 6054f38fcaSMauro Carvalho Chehabappropriately. The generic error codes are described at the 6154f38fcaSMauro Carvalho Chehab:ref:`Generic Error Codes <gen-errors>` chapter. 6254f38fcaSMauro Carvalho Chehab 6354f38fcaSMauro Carvalho ChehabEINVAL 6454f38fcaSMauro Carvalho Chehab The ``index`` is out of bounds. 65