Seth Woolley's Man Viewer

pts(4) - ptmx and pts, ptmx and pts - pseudo-terminal master and slave - man 4 pts

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

PTS(4)                     Linux Programmer's Manual                    PTS(4)

       ptmx and pts - pseudo-terminal master(5,8) and slave

       The  file(1,n)  /dev/ptmx  is a character file(1,n) with major number 5 and minor
       number 2, usually of mode 0666 and  of  root.root.   It  is
       used to create a pseudo-terminal master(5,8) and slave pair.

       When a process opens /dev/ptmx, it gets(3,n) a file(1,n) descriptor for a pseudo-
       terminal master(5,8) (PTM), and a pseudo-terminal slave (PTS) device is cre-
       ated  in(1,8) the /dev/pts directory. Each file(1,n) descriptor obtained by open-
       ing /dev/ptmx is an independent PTM with its own associated PTS,  whose
       path can be found by passing the descriptor to ptsname(3).

       Before  opening  the  pseudo-terminal slave, you must pass the master(5,8)'s
       file(1,n) descriptor to grantpt(3) and unlockpt(3).

       Once both the pseudo-terminal master(5,8) and slave are open(2,3,n), the slave pro-
       vides  processes  with an interface that is identical to that of a real

       Data written to the slave is presented  on  the  master(5,8)  descriptor  as
       input.   Data written to the master(5,8) is presented to the slave as input.

       In practice, pseudo-terminals are used for implementing terminal emula-
       tors such as xterm(1), in(1,8) which data read(2,n,1 builtins) from the pseudo-terminal mas-
       ter(5,8) is interpreted by the application in(1,8) the same way a  real  terminal
       would  interpret  the  data, and for implementing remote-login programs
       such as sshd(8), in(1,8) which data read(2,n,1 builtins) from the pseudo-terminal master(5,8)  is
       sent across the network to a client program that is connected to a ter-
       minal or terminal emulator.

       Pseudo-terminals can also be used to send(2,n) input to programs  that  nor-
       mally refuse to read(2,n,1 builtins) input from pipes (such as su(8), and passwd(1,5)(8)).

       /dev/ptmx, /dev/pts/*

       The  Linux  support  for the above (known as Unix98 pty naming) is done
       using the devpts filesystem, that should be mounted on /dev/pts.

       Before this Unix98 scheme, master(5,8) ptys were called /dev/ptyp0, ...  and
       slave  ptys /dev/ttyp0, ...  and one needed lots of preallocated device

       getpt(3), grantpt(3), ptsname(3), unlockpt(3)

Linux                             2002-10-09                            PTS(4)

References for this manual (incoming links)