1*54f38fcaSMauro Carvalho Chehab.. Permission is granted to copy, distribute and/or modify this 2*54f38fcaSMauro Carvalho Chehab.. document under the terms of the GNU Free Documentation License, 3*54f38fcaSMauro Carvalho Chehab.. Version 1.1 or any later version published by the Free Software 4*54f38fcaSMauro Carvalho Chehab.. Foundation, with no Invariant Sections, no Front-Cover Texts 5*54f38fcaSMauro Carvalho Chehab.. and no Back-Cover Texts. A copy of the license is included at 6*54f38fcaSMauro Carvalho Chehab.. Documentation/userspace-api/media/fdl-appendix.rst. 7*54f38fcaSMauro Carvalho Chehab.. 8*54f38fcaSMauro Carvalho Chehab.. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections 9*54f38fcaSMauro Carvalho Chehab 10*54f38fcaSMauro Carvalho Chehab.. _DMX_QUERYBUF: 11*54f38fcaSMauro Carvalho Chehab 12*54f38fcaSMauro Carvalho Chehab****************** 13*54f38fcaSMauro Carvalho Chehabioctl DMX_QUERYBUF 14*54f38fcaSMauro Carvalho Chehab****************** 15*54f38fcaSMauro Carvalho Chehab 16*54f38fcaSMauro Carvalho ChehabName 17*54f38fcaSMauro Carvalho Chehab==== 18*54f38fcaSMauro Carvalho Chehab 19*54f38fcaSMauro Carvalho ChehabDMX_QUERYBUF - Query the status of a buffer 20*54f38fcaSMauro Carvalho Chehab 21*54f38fcaSMauro Carvalho Chehab.. warning:: this API is still experimental 22*54f38fcaSMauro Carvalho Chehab 23*54f38fcaSMauro Carvalho Chehab 24*54f38fcaSMauro Carvalho ChehabSynopsis 25*54f38fcaSMauro Carvalho Chehab======== 26*54f38fcaSMauro Carvalho Chehab 27*54f38fcaSMauro Carvalho Chehab.. c:function:: int ioctl( int fd, DMX_QUERYBUF, struct dvb_buffer *argp ) 28*54f38fcaSMauro Carvalho Chehab :name: DMX_QUERYBUF 29*54f38fcaSMauro Carvalho Chehab 30*54f38fcaSMauro Carvalho Chehab 31*54f38fcaSMauro Carvalho ChehabArguments 32*54f38fcaSMauro Carvalho Chehab========= 33*54f38fcaSMauro Carvalho Chehab 34*54f38fcaSMauro Carvalho Chehab``fd`` 35*54f38fcaSMauro Carvalho Chehab File descriptor returned by :ref:`open() <dmx_fopen>`. 36*54f38fcaSMauro Carvalho Chehab 37*54f38fcaSMauro Carvalho Chehab``argp`` 38*54f38fcaSMauro Carvalho Chehab Pointer to struct :c:type:`dvb_buffer`. 39*54f38fcaSMauro Carvalho Chehab 40*54f38fcaSMauro Carvalho Chehab 41*54f38fcaSMauro Carvalho ChehabDescription 42*54f38fcaSMauro Carvalho Chehab=========== 43*54f38fcaSMauro Carvalho Chehab 44*54f38fcaSMauro Carvalho ChehabThis ioctl is part of the mmap streaming I/O method. It can 45*54f38fcaSMauro Carvalho Chehabbe used to query the status of a buffer at any time after buffers have 46*54f38fcaSMauro Carvalho Chehabbeen allocated with the :ref:`DMX_REQBUFS` ioctl. 47*54f38fcaSMauro Carvalho Chehab 48*54f38fcaSMauro Carvalho ChehabApplications set the ``index`` field. Valid index numbers range from zero 49*54f38fcaSMauro Carvalho Chehabto the number of buffers allocated with :ref:`DMX_REQBUFS` 50*54f38fcaSMauro Carvalho Chehab(struct :c:type:`dvb_requestbuffers` ``count``) minus one. 51*54f38fcaSMauro Carvalho Chehab 52*54f38fcaSMauro Carvalho ChehabAfter calling :ref:`DMX_QUERYBUF` with a pointer to this structure, 53*54f38fcaSMauro Carvalho Chehabdrivers return an error code or fill the rest of the structure. 54*54f38fcaSMauro Carvalho Chehab 55*54f38fcaSMauro Carvalho ChehabOn success, the ``offset`` will contain the offset of the buffer from the 56*54f38fcaSMauro Carvalho Chehabstart of the device memory, the ``length`` field its size, and the 57*54f38fcaSMauro Carvalho Chehab``bytesused`` the number of bytes occupied by data in the buffer (payload). 58*54f38fcaSMauro Carvalho Chehab 59*54f38fcaSMauro Carvalho ChehabReturn Value 60*54f38fcaSMauro Carvalho Chehab============ 61*54f38fcaSMauro Carvalho Chehab 62*54f38fcaSMauro Carvalho ChehabOn success 0 is returned, the ``offset`` will contain the offset of the 63*54f38fcaSMauro Carvalho Chehabbuffer from the start of the device memory, the ``length`` field its size, 64*54f38fcaSMauro Carvalho Chehaband the ``bytesused`` the number of bytes occupied by data in the buffer 65*54f38fcaSMauro Carvalho Chehab(payload). 66*54f38fcaSMauro Carvalho Chehab 67*54f38fcaSMauro Carvalho ChehabOn error it returns -1 and the ``errno`` variable is set 68*54f38fcaSMauro Carvalho Chehabappropriately. The generic error codes are described at the 69*54f38fcaSMauro Carvalho Chehab:ref:`Generic Error Codes <gen-errors>` chapter. 70*54f38fcaSMauro Carvalho Chehab 71*54f38fcaSMauro Carvalho ChehabEINVAL 72*54f38fcaSMauro Carvalho Chehab The ``index`` is out of bounds. 73