요약·해설과 원문, 전문 번역을 서로 분리했습니다. 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-close:
************
V4L2 close()
************
Name
====
v4l2-close - Close a V4L2 device
Synopsis
========
.. code-block:: c
#include <unistd.h>
.. c:function:: int close( int fd )
Arguments
=========
``fd``
File descriptor returned by :c:func:`open()`.
Description
===========
Closes the device. Any I/O in progress is terminated and resources
associated with the file descriptor are freed. However data format
parameters, current input or output, control values or other properties
remain unchanged.
Return Value
============
The function returns 0 on success, -1 on failure and the ``errno`` is
set appropriately. Possible error codes:
EBADF
``fd`` is not a valid open file descriptor.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
이름, 선언과 인자
1-29`v4l2-close`는 열린 V4L2 장치를 닫습니다. `<unistd.h>`를 포함하고 `int close(int fd)`를 호출합니다. `fd`는 `open()`이 반환한 file descriptor입니다.
열린 장치 descriptor 하나를 받습니다.
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: V4L
.. _func-close:
************
V4L2 close()
************
Name
====
v4l2-close - Close a V4L2 device
Synopsis
========
.. code-block:: c
#include <unistd.h>
.. c:function:: int close( int fd )
Arguments
=========
``fd``
File descriptor returned by :c:func:`open()`.
종료 동작과 반환값
30-45장치를 닫으면 진행 중인 모든 I/O가 종료되고 file descriptor에 연결된 resource가 해제됩니다. 그러나 data format parameter, 현재 input 또는 output, control value와 그 밖의 장치 속성은 바뀌지 않습니다.
성공하면 0, 실패하면 -1을 반환하고 `errno`를 설정합니다. `EBADF`는 `fd`가 유효하게 열린 file descriptor가 아님을 뜻합니다.
Descriptor 수명은 끝나지만 장치의 지속 설정은 유지됩니다.
Description
===========
Closes the device. Any I/O in progress is terminated and resources
associated with the file descriptor are freed. However data format
parameters, current input or output, control values or other properties
remain unchanged.
Return Value
============
The function returns 0 on success, -1 on failure and the ``errno`` is
set appropriately. Possible error codes:
EBADF
``fd`` is not a valid open file descriptor.
요약·해설
func-close.rst:1-45`close()`는 descriptor의 I/O와 resource를 끝내지만 장치의 format, input/output과 control 값은 그대로 유지합니다.