요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: MC
.. _media-func-ioctl:
*************
media ioctl()
*************
Name
====
media-ioctl - Control a media device
Synopsis
========
.. code-block:: c
#include <sys/ioctl.h>
``int ioctl(int fd, int request, void *argp)``
Arguments
=========
``fd``
File descriptor returned by :c:func:`open()`.
``request``
Media ioctl request code as defined in the media.h header file, for
example MEDIA_IOC_SETUP_LINK.
``argp``
Pointer to a request-specific structure.
Description
===========
The :ref:`ioctl() <media-func-ioctl>` function manipulates media device
parameters. The argument ``fd`` must be an open file descriptor.
The ioctl ``request`` code specifies the media function to be called. It
has encoded in it whether the argument is an input, output or read/write
parameter, and the size of the argument ``argp`` in bytes.
Macros and structures definitions specifying media ioctl requests and
their parameters are located in the media.h header file. All media ioctl
requests, their respective function and parameters are specified in
:ref:`media-user-func`.
Return Value
============
On success 0 is returned, on error -1 and the ``errno`` variable is set
appropriately. The generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.
Request-specific error codes are listed in the individual requests
descriptions.
When an ioctl that takes an output or read/write parameter fails, the
parameter remains unmodified.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
이름과 선언
1-23`media-ioctl`은 media device를 제어합니다. `<sys/ioctl.h>`를 include하고 `int ioctl(int fd, int request, void *argp)` 형식으로 호출합니다.
#include <sys/ioctl.h>
int ioctl(int fd, int request, void *argp);
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: MC
.. _media-func-ioctl:
*************
media ioctl()
*************
Name
====
media-ioctl - Control a media device
Synopsis
========
.. code-block:: c
#include <sys/ioctl.h>
``int ioctl(int fd, int request, void *argp)``
Arguments
24-36Media Controller ioctl 호출의 세 argument입니다.
Arguments
=========
``fd``
File descriptor returned by :c:func:`open()`.
``request``
Media ioctl request code as defined in the media.h header file, for
example MEDIA_IOC_SETUP_LINK.
``argp``
Pointer to a request-specific structure.
Request encoding과 media.h
37-51`media-func-ioctl`의 `ioctl()` 함수는 media device parameter를 조작합니다. `fd`는 열려 있는 file descriptor여야 합니다.
`request` code는 호출할 media function을 지정합니다. Argument가 input, output 또는 read/write parameter인지와 `argp` argument의 byte 단위 크기가 code에 encoding되어 있습니다.
Media ioctl request와 parameter를 지정하는 macro와 structure 정의는 `media.h` header file에 있습니다. 모든 media ioctl request와 각각의 function·parameter는 `media-user-func` 참조에서 정의합니다.
Request code와 request별 structure가 operation을 결정합니다.
Description
===========
The :ref:`ioctl() <media-func-ioctl>` function manipulates media device
parameters. The argument ``fd`` must be an open file descriptor.
The ioctl ``request`` code specifies the media function to be called. It
has encoded in it whether the argument is an input, output or read/write
parameter, and the size of the argument ``argp`` in bytes.
Macros and structures definitions specifying media ioctl requests and
their parameters are located in the media.h header file. All media ioctl
requests, their respective function and parameters are specified in
:ref:`media-user-func`.
반환값과 실패 시 parameter
52-63성공하면 0을 반환합니다. 오류가 발생하면 -1을 반환하고 `errno`를 알맞게 설정합니다. 공통 오류 code는 `Generic Error Codes <gen-errors>` 장에서 설명합니다.
Request별 오류 code는 각 request의 설명에 나옵니다.
Output 또는 read/write parameter를 받는 ioctl이 실패하면 그 parameter는 수정되지 않은 상태로 남습니다.
Return Value
============
On success 0 is returned, on error -1 and the ``errno`` variable is set
appropriately. The generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.
Request-specific error codes are listed in the individual requests
descriptions.
When an ioctl that takes an output or read/write parameter fails, the
parameter remains unmodified.
요약·해설
media-func-ioctl.rst:1-63`request`에는 parameter 방향과 byte 크기가 encoding됩니다. Output 또는 read/write ioctl이 실패하면 caller의 parameter는 수정되지 않습니다.