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