diff options
Diffstat (limited to 'man4/pts.4')
-rw-r--r-- | man4/pts.4 | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/man4/pts.4 b/man4/pts.4 new file mode 100644 index 000000000..e98263554 --- /dev/null +++ b/man4/pts.4 @@ -0,0 +1,70 @@ +.\" Hey Emacs! This file is -*- nroff -*- source. +.\" This man page was written by Jeremy Phelps <jphelps@notreached.net>. +.\" Notes added - aeb +.\" Redistribute and revise at will. +.\" +.TH PTS 4 "2002-10-09" "Linux" "Linux Programmer's Manual" +.SH NAME +ptmx and pts \- pseudo-terminal master and slave +.SH DESCRIPTION +The file \fB/dev/ptmx\fP is a character file with major number 5 and +minor number 2, usually of mode 0666 and owner.group of root.root. +It is used to create a pseudo-terminal master and slave pair. +.PP +When a process opens \fB/dev/ptmx\fP, it gets a file +descriptor for a pseudo-terminal master (PTM), +and a pseudo-terminal slave (PTS) device is created in the +.I /dev/pts +directory. Each file descriptor obtained by opening \fB/dev/ptmx\fP +is an independent PTM with its own associated PTS, whose path can +be found by passing the descriptor to +.BR ptsname (3). +.PP +Before opening the pseudo-terminal slave, you must pass the master's file +descriptor to +.BR grantpt (3) +and +.BR unlockpt (3). +.PP +Once both the pseudo-terminal master and slave are open, the slave provides +processes with an interface that is identical to that of a real terminal. +.PP +Data written to the slave is presented on the master descriptor as input. +Data written to the master is presented to the slave as input. +.PP +In practice, pseudo-terminals are used for implementing terminal emulators +such as +.BR xterm (1), +in which data read from the pseudo-terminal master is interpreted by the +application in the same way +a real terminal would interpret the data, and for implementing remote-login +programs such as +.BR sshd (8), +in which data read from the pseudo-terminal master is sent across the network +to a client program that is connected to a terminal or terminal emulator. +.PP +Pseudo-terminals can also be used to send input to programs that normally +refuse to read input from pipes (such as +.BR su (8), +and +.BR passwd (8)). +.SH FILES +.IR /dev/ptmx , +.I /dev/pts/* +.SH NOTES +The Linux support for the above (known as Unix98 pty naming) +is done using the +.I devpts +filesystem, that should be mounted on +.IR /dev/pts . +.LP +Before this Unix98 scheme, master ptys were called +.IR /dev/ptyp0 ", ..." +and slave ptys +.IR /dev/ttyp0 ", ..." +and one needed lots of preallocated device nodes. +.SH "SEE ALSO" +.BR getpt (3), +.BR grantpt (3), +.BR ptsname (3), +.BR unlockpt (3) |