PTY(4)
π PTY(4) β old-style compatibility pseudo-terminal driver π
okay so this is the PTY(4) page from the Kernel Interfaces Manual, bestie, and itβs literally all about the old-style compatibility pseudo-terminal driver. Think vintage Unix lore, but make it make sense. π
πΈ NAME πΈ
pty β old-style compatibility pseudo-terminal driver
β¨ SYNOPSIS β¨
device pty
π DESCRIPTION π
The pty driver provides support for the traditional BSD naming scheme that was used for accessing pseudo-terminals before it was replaced by pts(4). This traditional naming is still used in Linux. π§β¨
When the device /dev/ptyXX is being opened, a new terminal shall be created with the pts(4) driver. A device node for this terminal shall be created, which has the name /dev/ttyXX. No cap, thatβs the whole naming situation. π
The pty driver also provides a cloning System V /dev/ptmx device. Iconic behavior, honestly. π
π¨ New code should not try to allocate pseudo-terminals using this interface. It is only provided for compatibility with older C libraries that tried to open such devices when posix_openpt(2) was being called, and for running Linux binaries. Like, itβs giving βlegacy compatibility only,β not βmain character energy.β π
π FILES π
The BSD-style compatibility pseudo-terminal driver uses the following device names:
/dev/pty[l-sL-S][0-9a-v]β Pseudo-terminal master devices./dev/tty[l-sL-S][0-9a-v]β Pseudo-terminal slave devices./dev/ptmxβ Control device, returns a file descriptor to a new master pseudo-terminal when opened.
π©Ί DIAGNOSTICS π©Ί
None. Thatβs it. No diagnostics listed, bestie. The page is not out here giving us extra lore. π«Ά
π SEE ALSO π
posix_openpt(2), pts(4), tty(4)
π°οΈ HISTORY π°οΈ
A pseudo-terminal driver appeared in 4.2BSD. Vintage! π¦
π BUGS π
Unlike previous implementations, the master and slave device nodes are destroyed when the PTY becomes unused. A call to stat(2) on a nonexistent master device will already cause a new master device node to be created. The master device can only be destroyed by opening and closing it. Lowkey a trap, highkey important. π
The pty driver cannot be unloaded, because it cannot determine if it is being used. So yeah β itβs staying put, bestie. π
Source/version vibes: Debian. Date on the page: October 28, 2019. PTY(4) out β slay and goodbye. π
π«Ά
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms