← Documents Documentation/filesystems/devpts.rst GitHub 원문 ↗

Linux 6.18.37 · Filesystems

The Devpts Filesystem

devpts mount별 pty 독립성, ptmx 연결, global·reserved·instance별 pty 제한을 다룬 전문 번역입니다.

Source pathDocumentation/filesystems/devpts.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

요약·해설

devpts.rst:1-36

각 devpts mount는 독립 pty index 공간과 자체 `ptmx` node를 가집니다. pty 수는 전체 sysctl과 instance별 `max=` 옵션으로 제한하며 kernel 3.4를 경계로 `kernel.pty.max`의 의미가 달라집니다.

devpts 자원 범위
devpts mount마다 독립 instance 생성instance별 pty·index와 `ptmx` node 관리`max=<count>`로 instance 한도 설정`kernel.pty.max`와 `reserve`로 전체 자원 통제

instance 독립성과 global pty accounting을 함께 보여 줍니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 =====================
4 The Devpts Filesystem
5 =====================
6
7 Each mount of the devpts filesystem is now distinct such that ptys
8 and their indices allocated in one mount are independent from ptys
9 and their indices in all other mounts.
10
11 All mounts of the devpts filesystem now create a ``/dev/pts/ptmx`` node
12 with permissions ``0000``.
13
14 To retain backwards compatibility the a ptmx device node (aka any node
15 created with ``mknod name c 5 2``) when opened will look for an instance
16 of devpts under the name ``pts`` in the same directory as the ptmx device
17 node.
18
19 As an option instead of placing a ``/dev/ptmx`` device node at ``/dev/ptmx``
20 it is possible to place a symlink to ``/dev/pts/ptmx`` at ``/dev/ptmx`` or
21 to bind mount ``/dev/ptx/ptmx`` to ``/dev/ptmx``. If you opt for using
22 the devpts filesystem in this manner devpts should be mounted with
23 the ``ptmxmode=0666``, or ``chmod 0666 /dev/pts/ptmx`` should be called.
24
25 Total count of pty pairs in all instances is limited by sysctls::
26
27 kernel.pty.max = 4096 - global limit
28 kernel.pty.reserve = 1024 - reserved for filesystems mounted from the initial mount namespace
29 kernel.pty.nr - current count of ptys
30
31 Per-instance limit could be set by adding mount option ``max=<count>``.
32
33 This feature was added in kernel 3.4 together with
34 ``sysctl kernel.pty.reserve``.
35
36 In kernels older than 3.4 sysctl ``kernel.pty.max`` works as per-instance limit.
37

3. 한국어 전문 번역

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

독립 devpts instance와 ptmx 연결

1-24

devpts를 mount할 때마다 독립된 instance가 만들어집니다. 한 mount에서 할당한 pty와 index는 다른 모든 devpts mount의 pty 및 index와 분리됩니다.

각 devpts mount는 권한 `0000`인 `/dev/pts/ptmx` node를 생성합니다.

하위 호환성을 위해 `mknod name c 5 2`로 만든 것을 포함한 ptmx device node를 열면, 그 node와 같은 directory에서 `pts`라는 이름의 devpts instance를 찾습니다.

`/dev/ptmx`에 character device node를 두는 대신 `/dev/pts/ptmx`를 가리키는 symlink를 만들거나 해당 node를 `/dev/ptmx`에 bind mount할 수 있습니다. 이 방식을 사용하면 devpts를 `ptmxmode=0666`으로 mount하거나 `chmod 0666 /dev/pts/ptmx`를 실행해야 합니다. 원문의 bind mount 예시는 `/dev/ptx/ptmx`라고 적혀 있으며 이 경로 표기를 그대로 보존합니다.

ptmx에서 devpts instance 찾기
각 devpts mount가 독립 pty index namespace 생성mount root에 권한 `0000`의 `ptmx` node 생성legacy `c 5 2` node는 같은 directory의 `pts` instance 탐색대안으로 `/dev/ptmx`를 `/dev/pts/ptmx`에 연결`ptmxmode=0666` 또는 `chmod 0666`으로 접근 허용

전통적인 device node와 symlink·bind mount 방식의 연결 관계입니다.

.. SPDX-License-Identifier: GPL-2.0

=====================
The Devpts Filesystem
=====================

Each mount of the devpts filesystem is now distinct such that ptys
and their indices allocated in one mount are independent from ptys
and their indices in all other mounts.

All mounts of the devpts filesystem now create a ``/dev/pts/ptmx`` node
with permissions ``0000``.

To retain backwards compatibility the a ptmx device node (aka any node
created with ``mknod name c 5 2``) when opened will look for an instance
of devpts under the name ``pts`` in the same directory as the ptmx device
node.

As an option instead of placing a ``/dev/ptmx`` device node at ``/dev/ptmx``
it is possible to place a symlink to ``/dev/pts/ptmx`` at ``/dev/ptmx`` or
to bind mount ``/dev/ptx/ptmx`` to ``/dev/ptmx``.  If you opt for using
the devpts filesystem in this manner devpts should be mounted with
the ``ptmxmode=0666``, or ``chmod 0666 /dev/pts/ptmx`` should be called.

전역·예약·instance별 pty 제한

25-36

모든 devpts instance를 합친 pty pair 수는 sysctl로 제한합니다. `kernel.pty.max`는 전역 한도, `kernel.pty.reserve`는 초기 mount namespace에서 mount한 filesystem을 위해 예약한 수, `kernel.pty.nr`은 현재 pty 수입니다.

각 instance의 별도 한도는 `max=<count>` mount option으로 설정합니다.

전역 한도와 `kernel.pty.reserve`를 함께 사용하는 동작은 kernel 3.4에 추가되었습니다. 3.4보다 오래된 kernel에서는 `kernel.pty.max`가 instance별 한도로 동작합니다.

devpts pty 제한
항목현재 의미참고
`kernel.pty.max`모든 instance의 전역 한도3.4 이전에는 instance별 한도
`kernel.pty.reserve`초기 mount namespace용 예약량kernel 3.4에서 추가
`kernel.pty.nr`현재 전체 pty 수read-only 상태 값
`max=<count>`해당 devpts instance 한도mount option

현재 kernel의 전역 accounting과 이전 kernel의 의미 차이를 정리합니다.

Total count of pty pairs in all instances is limited by sysctls::

    kernel.pty.max = 4096        - global limit
    kernel.pty.reserve = 1024        - reserved for filesystems mounted from the initial mount namespace
    kernel.pty.nr                - current count of ptys

Per-instance limit could be set by adding mount option ``max=<count>``.

This feature was added in kernel 3.4 together with
``sysctl kernel.pty.reserve``.

In kernels older than 3.4 sysctl ``kernel.pty.max`` works as per-instance limit.