← Documents Documentation/userspace-api/media/cec/cec-func-ioctl.rst GitHub 원문 ↗

Linux 6.18.37 · Userspace API / Media / CEC

CEC ioctl()

CEC ioctl request code와 request-specific 구조체, 반환값 및 실패 시 출력 불변 보장을 설명합니다.

Source pathDocumentation/userspace-api/media/cec/cec-func-ioctl.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

cec-func-ioctl.rst:1-63

CEC `ioctl()`의 `fd`, `request`, `argp` 계약과 request code에 encoding된 방향·크기, 실패 시 parameter 불변 규칙을 설명합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2 .. c:namespace:: CEC
3
4 .. _cec-func-ioctl:
5
6 ***********
7 cec ioctl()
8 ***********
9
10 Name
11 ====
12
13 cec-ioctl - Control a cec device
14
15 Synopsis
16 ========
17
18 .. code-block:: c
19
20 #include <sys/ioctl.h>
21
22 ``int ioctl(int fd, int request, void *argp)``
23
24 Arguments
25 =========
26
27 ``fd``
28 File descriptor returned by :c:func:`open()`.
29
30 ``request``
31 CEC ioctl request code as defined in the cec.h header file, for
32 example :ref:`CEC_ADAP_G_CAPS <CEC_ADAP_G_CAPS>`.
33
34 ``argp``
35 Pointer to a request-specific structure.
36
37 Description
38 ===========
39
40 The :c:func:`ioctl()` function manipulates cec device parameters. The
41 argument ``fd`` must be an open file descriptor.
42
43 The ioctl ``request`` code specifies the cec function to be called. It
44 has encoded in it whether the argument is an input, output or read/write
45 parameter, and the size of the argument ``argp`` in bytes.
46
47 Macros and structures definitions specifying cec ioctl requests and
48 their parameters are located in the cec.h header file. All cec ioctl
49 requests, their respective function and parameters are specified in
50 :ref:`cec-user-func`.
51
52 Return Value
53 ============
54
55 On success 0 is returned, on error -1 and the ``errno`` variable is set
56 appropriately. The generic error codes are described at the
57 :ref:`Generic Error Codes <gen-errors>` chapter.
58
59 Request-specific error codes are listed in the individual requests
60 descriptions.
61
62 When an ioctl that takes an output or read/write parameter fails, the
63 parameter remains unmodified.
64

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

이름과 선언

1-22

`cec-ioctl`은 CEC device를 제어합니다. `<sys/ioctl.h>`를 포함하며 함수 형태는 `int ioctl(int fd, int request, void *argp)`입니다.

.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: CEC

.. _cec-func-ioctl:

***********
cec ioctl()
***********

Name
====

cec-ioctl - Control a cec device

Synopsis
========

.. code-block:: c

    #include <sys/ioctl.h>

``int ioctl(int fd, int request, void *argp)``

인자

23-37

`fd`는 `open()`이 반환한 file descriptor입니다.

`request`는 `cec.h` header에 정의된 CEC ioctl request code입니다. 예로 `CEC_ADAP_G_CAPS`가 있습니다.

`argp`는 request마다 형식이 다른 구조체를 가리키는 pointer입니다.

ioctl() 인자
항목설명
fd열린 CEC device descriptor
requestcec.h의 CEC ioctl code
argprequest-specific structure pointer

request가 작업과 argp 구조를 결정합니다.


Arguments
=========

``fd``
    File descriptor returned by :c:func:`open()`.

``request``
    CEC ioctl request code as defined in the cec.h header file, for
    example :ref:`CEC_ADAP_G_CAPS <CEC_ADAP_G_CAPS>`.

``argp``
    Pointer to a request-specific structure.

Description

동작

38-51

`ioctl()`은 CEC device parameter를 조작하며 `fd`는 열린 file descriptor여야 합니다.

`request` code는 호출할 CEC 기능을 지정합니다. code에는 argument가 input, output, read/write 중 무엇인지와 `argp` argument의 byte 크기가 encoding되어 있습니다.

CEC ioctl request와 parameter를 정의하는 macro와 structure는 `cec.h`에 있습니다. 모든 request와 해당 기능·parameter는 CEC function reference에서 설명합니다.

CEC ioctl 해석
열린 CEC fdrequest code 선택input·output·read/write 방향 해석argp byte 크기 해석request-specific 구조체 처리CEC 기능 실행

request code가 데이터 방향과 크기, 실행 기능을 함께 지정합니다.

===========

The :c:func:`ioctl()` function manipulates cec device parameters. The
argument ``fd`` must be an open file descriptor.

The ioctl ``request`` code specifies the cec 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 cec ioctl requests and
their parameters are located in the cec.h header file. All cec ioctl
requests, their respective function and parameters are specified in
:ref:`cec-user-func`.

반환값과 오류

52-63

성공하면 0, 오류이면 -1을 반환하고 `errno`를 설정합니다. 일반 오류 code는 Generic Error Codes 장을 참조합니다.

request-specific 오류는 각 request 설명에 따로 나열됩니다.

output 또는 read/write parameter를 받는 ioctl이 실패하면 그 parameter는 변경되지 않은 상태로 남습니다.

ioctl() 결과
항목설명
성공0
오류-1, errno 설정
일반 오류Generic Error Codes 참조
고유 오류개별 request 설명 참조
output·read/write 실패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.