18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
28c2ecf20Sopenharmony_ci.. c:namespace:: DTV.dmx
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci.. _dmx_fread:
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci=======================
78c2ecf20Sopenharmony_ciDigital TV demux read()
88c2ecf20Sopenharmony_ci=======================
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciName
118c2ecf20Sopenharmony_ci----
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciDigital TV demux read()
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciSynopsis
168c2ecf20Sopenharmony_ci--------
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci.. c:function:: size_t read(int fd, void *buf, size_t count)
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ciArguments
218c2ecf20Sopenharmony_ci---------
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci``fd``
248c2ecf20Sopenharmony_ci  File descriptor returned by a previous call to :c:func:`open()`.
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci ``buf``
278c2ecf20Sopenharmony_ci   Buffer to be filled
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci``count``
308c2ecf20Sopenharmony_ci   Max number of bytes to read
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ciDescription
338c2ecf20Sopenharmony_ci-----------
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ciThis system call returns filtered data, which might be section or Packetized
368c2ecf20Sopenharmony_ciElementary Stream (PES) data. The filtered data is transferred from
378c2ecf20Sopenharmony_cithe driver’s internal circular buffer to ``buf``. The maximum amount of data
388c2ecf20Sopenharmony_cito be transferred is implied by count.
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci.. note::
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci   if a section filter created with
438c2ecf20Sopenharmony_ci   :c:type:`DMX_CHECK_CRC <dmx_sct_filter_params>` flag set,
448c2ecf20Sopenharmony_ci   data that fails on CRC check will be silently ignored.
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ciReturn Value
478c2ecf20Sopenharmony_ci------------
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ciOn success 0 is returned.
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ciOn error -1 is returned, and the ``errno`` variable is set
528c2ecf20Sopenharmony_ciappropriately.
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{2.5cm}|p{15.0cm}|
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci.. flat-table::
578c2ecf20Sopenharmony_ci    :header-rows:  0
588c2ecf20Sopenharmony_ci    :stub-columns: 0
598c2ecf20Sopenharmony_ci    :widths: 1 16
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci    -  -  ``EWOULDBLOCK``
628c2ecf20Sopenharmony_ci       -  No data to return and ``O_NONBLOCK`` was specified.
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci    -  -  ``EOVERFLOW``
658c2ecf20Sopenharmony_ci       -  The filtered data was not read from the buffer in due time,
668c2ecf20Sopenharmony_ci	  resulting in non-read data being lost. The buffer is flushed.
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci    -  -  ``ETIMEDOUT``
698c2ecf20Sopenharmony_ci       -  The section was not loaded within the stated timeout period.
708c2ecf20Sopenharmony_ci          See ioctl :ref:`DMX_SET_FILTER` for how to set a timeout.
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci    -  -  ``EFAULT``
738c2ecf20Sopenharmony_ci       -  The driver failed to write to the callers buffer due to an
748c2ecf20Sopenharmony_ci          invalid \*buf pointer.
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ciThe generic error codes are described at the
778c2ecf20Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter.
78