PTM(4)
okay so bestie, welcome to PTM(4) β the Kernel Interfaces Manual page for the pseudo-terminal multiplexor device. It's literally the backstage pass to /dev/ptm, and we're gonna go through it together, no cap. π
β¨
β¨ NAME β¨
ptm β pseudo-terminal multiplexor device π
π¦ SYNOPSIS π¦
yep, this is the whole vibe:
pseudo-device pty
π DESCRIPTION π
okay so the ptm driver is the backend for the /dev/ptm device, and it supports three ioctl(2)s. The first is TIOCPTMGET β it allocates a free pseudo-terminal device, sets its user ID to the calling user, revoke(2)s it, and returns the opened file descriptors for both the master and the slave pseudo-terminal device to the caller in a struct ptmget. That struct is giving:
struct ptmget {
int cfd;
int sfd;
char cn[PATH_MAX];
char sn[PATH_MAX];
};
where cfd and sfd contain the master resp. slave device's file descriptor and cn and sn the corresponding paths in the file system. π
The /dev/ptmx device supports two more ioctl(2)s: TIOCGRANTPT, which is used by grantpt(3), and TIOCPTSNAME, which is used by ptsname(3).
The ptm device is included with the pseudo-device pty(4). It can be disabled by adding options NO_DEV_PTM to the kernel configuration.
π FILES π
these are the paths you need to know, bestie:
/dev/ptmβ ptm access device/dev/ptmxβ ptm cloning device, used to implement Unix98 ptys
π SEE ALSO π
go give these a read when you're done slaying:
π HISTORY π
The /dev/ptm device appeared in OpenBSD 3.5 and was ported to NetBSD 3.0. iconic behavior, honestly. π₯
π and that's the tea: this page comes from Debian, dated November 30, 2013, and it's the PTM(4) manual β mwah, bestie π
π¦ where this page comes from
- nixpkgs unstable: netbsd-source 11.0
- Copyright (c) 2004 Thomas Klausner
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms