요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. 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.
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.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
독립 devpts instance와 ptmx 연결
1-24devpts를 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`라고 적혀 있으며 이 경로 표기를 그대로 보존합니다.
전통적인 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별 한도로 동작합니다.
현재 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.
요약·해설
devpts.rst:1-36각 devpts mount는 독립 pty index 공간과 자체 `ptmx` node를 가집니다. pty 수는 전체 sysctl과 instance별 `max=` 옵션으로 제한하며 kernel 3.4를 경계로 `kernel.pty.max`의 의미가 달라집니다.
instance 독립성과 global pty accounting을 함께 보여 줍니다.