요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0
.. _GPIO_GET_LINEINFO_WATCH_IOCTL:
*****************************
GPIO_GET_LINEINFO_WATCH_IOCTL
*****************************
.. warning::
This ioctl is part of chardev_v1.rst and is obsoleted by
gpio-v2-get-lineinfo-watch-ioctl.rst.
Name
====
GPIO_GET_LINEINFO_WATCH_IOCTL - Enable watching a line for changes to its
request state and configuration information.
Synopsis
========
.. c:macro:: GPIO_GET_LINEINFO_WATCH_IOCTL
``int ioctl(int chip_fd, GPIO_GET_LINEINFO_WATCH_IOCTL, struct gpioline_info *info)``
Arguments
=========
``chip_fd``
The file descriptor of the GPIO character device returned by `open()`.
``info``
The :c:type:`line_info<gpioline_info>` struct to be populated, with
the ``offset`` set to indicate the line to watch
Description
===========
Enable watching a line for changes to its request state and configuration
information. Changes to line info include a line being requested, released
or reconfigured.
.. note::
Watching line info is not generally required, and would typically only be
used by a system monitoring component.
The line info does NOT include the line value.
The line must be requested using gpio-get-linehandle-ioctl.rst or
gpio-get-lineevent-ioctl.rst to access its value, and the line event can
monitor a line for events using gpio-lineevent-data-read.rst.
By default all lines are unwatched when the GPIO chip is opened.
Multiple lines may be watched simultaneously by adding a watch for each.
Once a watch is set, any changes to line info will generate events which can be
read from the ``chip_fd`` as described in
gpio-lineinfo-changed-read.rst.
Adding a watch to a line that is already watched is an error (**EBUSY**).
Watches are specific to the ``chip_fd`` and are independent of watches
on the same GPIO chip opened with a separate call to `open()`.
First added in 5.7.
Return Value
============
On success 0 and ``info`` is populated with the current line info.
On error -1 and the ``errno`` variable is set appropriately.
Common error codes are described in error-codes.rst.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
상태, 이름, 호출 형식
1-35`GPIO_GET_LINEINFO_WATCH_IOCTL`은 GPIO line의 요청 상태와 configuration 정보가 바뀌는지 감시하도록 설정합니다. ABI v1의 ioctl이며 `gpio-v2-get-lineinfo-watch-ioctl.rst`로 대체되었습니다.
호출 형식은 `int ioctl(int chip_fd, GPIO_GET_LINEINFO_WATCH_IOCTL, struct gpioline_info *info)`입니다. `chip_fd`는 GPIO character device를 `open()`해 얻습니다. `info`는 kernel이 채울 `gpioline_info` 구조체이며, 감시할 line을 고르도록 호출 전에 `offset`을 설정합니다.
입출력 구조체가 감시 대상과 현재 정보를 함께 전달합니다.
.. SPDX-License-Identifier: GPL-2.0
.. _GPIO_GET_LINEINFO_WATCH_IOCTL:
*****************************
GPIO_GET_LINEINFO_WATCH_IOCTL
*****************************
.. warning::
This ioctl is part of chardev_v1.rst and is obsoleted by
gpio-v2-get-lineinfo-watch-ioctl.rst.
Name
====
GPIO_GET_LINEINFO_WATCH_IOCTL - Enable watching a line for changes to its
request state and configuration information.
Synopsis
========
.. c:macro:: GPIO_GET_LINEINFO_WATCH_IOCTL
``int ioctl(int chip_fd, GPIO_GET_LINEINFO_WATCH_IOCTL, struct gpioline_info *info)``
Arguments
=========
``chip_fd``
The file descriptor of the GPIO character device returned by `open()`.
``info``
The :c:type:`line_info<gpioline_info>` struct to be populated, with
the ``offset`` set to indicate the line to watch
감시 대상과 값 접근
36-52감시 대상은 line의 요청 상태와 configuration 정보입니다. Line이 요청되거나 해제되거나 재구성되면 line info 변경으로 간주합니다.
일반적인 프로그램에는 line info 감시가 필요하지 않으며 보통 system monitoring component가 사용합니다. Line info에는 line 값이 포함되지 않습니다.
값에 접근하려면 `gpio-get-linehandle-ioctl.rst` 또는 `gpio-get-lineevent-ioctl.rst`로 line을 요청해야 합니다. Line event의 edge event는 `gpio-lineevent-data-read.rst`로 감시합니다.
Line metadata 감시와 값/edge 감시는 별도 경로입니다.
Description
===========
Enable watching a line for changes to its request state and configuration
information. Changes to line info include a line being requested, released
or reconfigured.
.. note::
Watching line info is not generally required, and would typically only be
used by a system monitoring component.
The line info does NOT include the line value.
The line must be requested using gpio-get-linehandle-ioctl.rst or
gpio-get-lineevent-ioctl.rst to access its value, and the line event can
monitor a line for events using gpio-lineevent-data-read.rst.
등록, 이벤트 읽기, fd별 독립성
53-67GPIO chip을 열면 기본적으로 모든 line은 감시하지 않는 상태입니다. 여러 line을 동시에 감시하려면 각 line에 watch를 하나씩 추가합니다.
Watch를 설정한 뒤 line info가 바뀌면 event가 생성되고 `gpio-lineinfo-changed-read.rst`의 방식으로 `chip_fd`에서 읽을 수 있습니다. 이미 감시 중인 line에 watch를 다시 추가하면 `EBUSY`입니다.
Watch는 특정 `chip_fd`에 속합니다. 같은 GPIO chip을 별도의 `open()` 호출로 열어 만든 다른 descriptor의 watch와는 독립적입니다. 이 ioctl은 Linux 5.7에서 처음 추가되었습니다.
각 chip_fd가 자체 감시 집합과 event stream을 가집니다.
By default all lines are unwatched when the GPIO chip is opened.
Multiple lines may be watched simultaneously by adding a watch for each.
Once a watch is set, any changes to line info will generate events which can be
read from the ``chip_fd`` as described in
gpio-lineinfo-changed-read.rst.
Adding a watch to a line that is already watched is an error (**EBUSY**).
Watches are specific to the ``chip_fd`` and are independent of watches
on the same GPIO chip opened with a separate call to `open()`.
First added in 5.7.
반환값
68-74성공하면 0을 반환하고 `info`를 현재 line 정보로 채웁니다. 실패하면 -1을 반환하고 `errno`를 설정합니다. 공통 오류 코드는 `error-codes.rst`에 설명되어 있습니다.
Return Value
============
On success 0 and ``info`` is populated with the current line info.
On error -1 and the ``errno`` variable is set appropriately.
Common error codes are described in error-codes.rst.
요약·해설
gpio-get-lineinfo-watch-ioctl.rst:1-74ABI v1에서 line 요청·해제·재구성 정보를 chip_fd별로 감시하는 ioctl을 설명합니다.
원문의 read/ioctl prototype, struct, flag, errno, clock, buffer 규칙과 줄 좌표를 보존해 전문 번역했습니다.