← Documents Documentation/userspace-api/media/mediactl/media-func-close.rst GitHub 원문 ↗

Linux 6.18.37 · Userspace API / Media / Media Controller

media close()

Media device file descriptor를 닫을 때 resource와 configuration에 미치는 영향을 정의합니다.

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

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

1. 요약·해설

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

요약·해설

media-func-close.rst:1-43

`close()`는 descriptor resource를 해제하지만 media device configuration은 변경하지 않습니다. 성공은 0, 유효하지 않은 descriptor는 `EBADF`입니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2 .. c:namespace:: MC
3
4 .. _media-func-close:
5
6 *************
7 media close()
8 *************
9
10 Name
11 ====
12
13 media-close - Close a media device
14
15 Synopsis
16 ========
17
18 .. code-block:: c
19
20 #include <unistd.h>
21
22 .. c:function:: int close( int fd )
23
24 Arguments
25 =========
26
27 ``fd``
28 File descriptor returned by :c:func:`open()`.
29
30 Description
31 ===========
32
33 Closes the media device. Resources associated with the file descriptor
34 are freed. The device configuration remain unchanged.
35
36 Return Value
37 ============
38
39 :c:func:`close()` returns 0 on success. On error, -1 is returned, and
40 ``errno`` is set appropriately. Possible error codes are:
41
42 EBADF
43 ``fd`` is not a valid open file descriptor.
44

3. 한국어 전문 번역

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

이름과 선언

1-23

이 문서는 GFDL 조건의 `MC` C namespace에서 media device를 닫는 `media-close` operation을 설명합니다.

`<unistd.h>`를 include하고 `int close(int fd)`를 호출합니다.

#include <unistd.h>

int close(int fd);
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: MC

.. _media-func-close:

*************
media close()
*************

Name
====

media-close - Close a media device

Synopsis
========

.. code-block:: c

    #include <unistd.h>

.. c:function:: int close( int fd )

Argument와 동작

24-35

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

`close()`는 media device를 닫고 file descriptor와 연결된 resource를 해제합니다. Device configuration은 바뀌지 않습니다.

Arguments
=========

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

Description
===========

Closes the media device. Resources associated with the file descriptor
are freed. The device configuration remain unchanged.

반환값과 오류

36-43

성공하면 `close()`는 0을 반환합니다. 오류가 발생하면 -1을 반환하고 `errno`를 알맞게 설정합니다.

`EBADF`는 `fd`가 유효하게 열린 file descriptor가 아님을 뜻합니다.

close() 결과
반환값의미
0성공, device configuration 유지
-1 / EBADF유효한 open file descriptor가 아님

성공과 오류 contract입니다.

Return Value
============

:c:func:`close()` returns 0 on success. On error, -1 is returned, and
``errno`` is set appropriately. Possible error codes are:

EBADF
    ``fd`` is not a valid open file descriptor.