요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: V4L
.. _func-ioctl:
************
V4L2 ioctl()
************
Name
====
v4l2-ioctl - Program a V4L2 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``
V4L2 ioctl request code as defined in the ``videodev2.h`` header
file, for example VIDIOC_QUERYCAP.
``argp``
Pointer to a function parameter, usually a structure.
Description
===========
The :ref:`ioctl() <func-ioctl>` function is used to program V4L2 devices. The
argument ``fd`` must be an open file descriptor. An ioctl ``request``
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
defines specifying V4L2 ioctl requests are located in the
``videodev2.h`` header file. Applications should use their own copy, not
include the version in the kernel sources on the system they compile on.
All V4L2 ioctl requests, their respective function and parameters are
specified in :ref:`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.
When an ioctl that takes an output or read/write parameter fails, the
parameter remains unmodified.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
이름, 선언과 인자
1-36`v4l2-ioctl`은 V4L2 장치를 program하는 함수입니다. `<sys/ioctl.h>`를 포함하고 `int ioctl(int fd, int request, void *argp)` 형식으로 호출합니다.
열린 descriptor, request code와 parameter pointer를 전달합니다.
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: V4L
.. _func-ioctl:
************
V4L2 ioctl()
************
Name
====
v4l2-ioctl - Program a V4L2 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``
V4L2 ioctl request code as defined in the ``videodev2.h`` header
file, for example VIDIOC_QUERYCAP.
``argp``
Pointer to a function parameter, usually a structure.
Request ABI와 반환값
37-58`ioctl()`로 V4L2 장치를 program하려면 `fd`가 열린 file descriptor여야 합니다. 각 `request`에는 argument가 input, output 또는 read/write parameter인지와 `argp`가 가리키는 argument 크기가 byte 단위로 encoding되어 있습니다.
V4L2 ioctl request의 macro와 define은 `videodev2.h`에 있습니다. Application은 system의 kernel source tree에 있는 header를 compile 시 직접 포함하지 말고 자체 사본을 사용해야 합니다. 모든 V4L2 request와 기능, parameter는 사용자 함수 참조에 정의됩니다.
성공하면 0, 오류면 -1을 반환하고 `errno`를 설정합니다. 일반 오류 코드는 Generic Error Codes 절을 따릅니다. Output 또는 read/write parameter를 받는 ioctl이 실패하면 해당 parameter는 수정되지 않은 상태로 남습니다.
Request가 규정한 방향과 크기 계약에 맞춰 parameter를 전달합니다.
Description
===========
The :ref:`ioctl() <func-ioctl>` function is used to program V4L2 devices. The
argument ``fd`` must be an open file descriptor. An ioctl ``request``
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
defines specifying V4L2 ioctl requests are located in the
``videodev2.h`` header file. Applications should use their own copy, not
include the version in the kernel sources on the system they compile on.
All V4L2 ioctl requests, their respective function and parameters are
specified in :ref:`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.
When an ioctl that takes an output or read/write parameter fails, the
parameter remains unmodified.
요약·해설
func-ioctl.rst:1-58V4L2 ioctl request는 argument 방향과 크기를 encoding하며, 호출 실패 시 output 또는 read/write parameter를 수정하지 않습니다.