요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.dmx
.. _dmx_fread:
=======================
Digital TV demux read()
=======================
Name
----
Digital TV demux read()
Synopsis
--------
.. c:function:: size_t read(int fd, void *buf, size_t count)
Arguments
---------
``fd``
File descriptor returned by a previous call to :c:func:`open()`.
``buf``
Buffer to be filled
``count``
Max number of bytes to read
Description
-----------
This system call returns filtered data, which might be section or Packetized
Elementary Stream (PES) data. The filtered data is transferred from
the driver's internal circular buffer to ``buf``. The maximum amount of data
to be transferred is implied by count.
.. note::
if a section filter created with
:c:type:`DMX_CHECK_CRC <dmx_sct_filter_params>` flag set,
data that fails on CRC check will be silently ignored.
Return Value
------------
On success 0 is returned.
On error -1 is returned, and the ``errno`` variable is set
appropriately.
.. tabularcolumns:: |p{2.5cm}|p{15.0cm}|
.. flat-table::
:header-rows: 0
:stub-columns: 0
:widths: 1 16
- - ``EWOULDBLOCK``
- No data to return and ``O_NONBLOCK`` was specified.
- - ``EOVERFLOW``
- The filtered data was not read from the buffer in due time,
resulting in non-read data being lost. The buffer is flushed.
- - ``ETIMEDOUT``
- The section was not loaded within the stated timeout period.
See ioctl :ref:`DMX_SET_FILTER` for how to set a timeout.
- - ``EFAULT``
- The driver failed to write to the callers buffer due to an
invalid \*buf pointer.
The generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
이름과 호출 형식
1-18이 문서는 GFDL-1.1-no-invariants-or-later 라이선스와 `DTV.dmx` C namespace를 사용하며 `dmx_fread` 참조 대상으로 Digital TV demux의 `read()`를 설명합니다.
함수 원형은 `size_t read(int fd, void *buf, size_t count)`입니다.
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: DTV.dmx
.. _dmx_fread:
=======================
Digital TV demux read()
=======================
Name
----
Digital TV demux read()
Synopsis
--------
.. c:function:: size_t read(int fd, void *buf, size_t count)
읽기 인자
19-30`fd`는 앞선 `open()` 호출이 반환한 file descriptor입니다.
`buf`는 읽은 데이터를 채울 버퍼이고, `count`는 읽을 최대 바이트 수입니다.
필터 데이터 전송에 쓰는 세 인자입니다.
Arguments
---------
``fd``
File descriptor returned by a previous call to :c:func:`open()`.
``buf``
Buffer to be filled
``count``
Max number of bytes to read
필터 데이터와 CRC 처리
31-45이 시스템 호출은 필터링된 데이터를 반환합니다. 데이터는 section일 수도 있고 Packetized Elementary Stream(PES)일 수도 있습니다.
필터링된 데이터는 드라이버 내부 circular buffer에서 `buf`로 복사되며, 최대 전송량은 `count`로 정합니다.
section 필터를 만들 때 `DMX_CHECK_CRC <dmx_sct_filter_params>` 플래그를 설정했다면 CRC 검사에 실패한 데이터는 알림 없이 버려집니다.
드라이버 버퍼에서 사용자 버퍼로 필터 결과가 이동합니다.
Description
-----------
This system call returns filtered data, which might be section or Packetized
Elementary Stream (PES) data. The filtered data is transferred from
the driver's internal circular buffer to ``buf``. The maximum amount of data
to be transferred is implied by count.
.. note::
if a section filter created with
:c:type:`DMX_CHECK_CRC <dmx_sct_filter_params>` flag set,
data that fails on CRC check will be silently ignored.
반환값과 오류
46-77원문은 성공 시 0을 반환한다고 명시합니다. 함수 원형은 `size_t`이지만 반환 절의 문구는 수정하지 않고 그대로 옮깁니다.
오류가 발생하면 -1을 반환하고 `errno`를 적절히 설정합니다.
원문의 flat-table 오류 조건을 정리합니다.
그 밖의 공통 오류 코드는 `Generic Error Codes <gen-errors>` 장에서 설명합니다.
Return Value
------------
On success 0 is returned.
On error -1 is returned, and the ``errno`` variable is set
appropriately.
.. tabularcolumns:: |p{2.5cm}|p{15.0cm}|
.. flat-table::
:header-rows: 0
:stub-columns: 0
:widths: 1 16
- - ``EWOULDBLOCK``
- No data to return and ``O_NONBLOCK`` was specified.
- - ``EOVERFLOW``
- The filtered data was not read from the buffer in due time,
resulting in non-read data being lost. The buffer is flushed.
- - ``ETIMEDOUT``
- The section was not loaded within the stated timeout period.
See ioctl :ref:`DMX_SET_FILTER` for how to set a timeout.
- - ``EFAULT``
- The driver failed to write to the callers buffer due to an
invalid \*buf pointer.
The generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.
요약·해설
dmx-fread.rst:1-77read()는 필터 결과를 최대 count 바이트만큼 buf로 옮깁니다. CRC 실패 section의 조용한 폐기와 비차단·오버플로·시간 초과 오류를 구분해야 합니다.