]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" This man page was written by Jeremy Phelps <jphelps@notreached.net>. |
2 | .\" Notes added - aeb | |
2297bf0e | 3 | .\" |
73624cb2 | 4 | .\" %%%LICENSE_START(FREELY_REDISTRIBUTABLE) |
fea681da | 5 | .\" Redistribute and revise at will. |
8ff7380d | 6 | .\" %%%LICENSE_END |
fea681da | 7 | .\" |
4c1c5274 | 8 | .TH pts 4 (date) "Linux man-pages (unreleased)" |
fea681da | 9 | .SH NAME |
b218b023 | 10 | ptmx, pts \- pseudoterminal master and slave |
fea681da | 11 | .SH DESCRIPTION |
509e2056 MK |
12 | The file |
13 | .I /dev/ptmx | |
fac73de4 | 14 | (the pseudoterminal multiplexor device) |
509e2056 | 15 | is a character file with major number 5 and |
6f5b156b | 16 | minor number 2, usually with mode 0666 and ownership root:root. |
b218b023 | 17 | It is used to create a pseudoterminal master and slave pair. |
fea681da | 18 | .PP |
509e2056 MK |
19 | When a process opens |
20 | .IR /dev/ptmx , | |
21 | it gets a file | |
86e59106 MK |
22 | descriptor for a pseudoterminal master |
23 | and a pseudoterminal slave device is created in the | |
fea681da | 24 | .I /dev/pts |
c13182ef | 25 | directory. |
509e2056 | 26 | Each file descriptor obtained by opening |
1ae6b2c7 | 27 | .I /dev/ptmx |
86e59106 MK |
28 | is an independent pseudoterminal master with its own associated slave, |
29 | whose path can | |
d9cb0d7d | 30 | be found by passing the file descriptor to |
fea681da MK |
31 | .BR ptsname (3). |
32 | .PP | |
b218b023 | 33 | Before opening the pseudoterminal slave, you must pass the master's file |
fea681da MK |
34 | descriptor to |
35 | .BR grantpt (3) | |
36 | and | |
37 | .BR unlockpt (3). | |
38 | .PP | |
b218b023 | 39 | Once both the pseudoterminal master and slave are open, the slave provides |
fea681da MK |
40 | processes with an interface that is identical to that of a real terminal. |
41 | .PP | |
d9cb0d7d | 42 | Data written to the slave is presented on the master file descriptor as input. |
fea681da MK |
43 | Data written to the master is presented to the slave as input. |
44 | .PP | |
b218b023 | 45 | In practice, pseudoterminals are used for implementing terminal emulators |
c13182ef | 46 | such as |
fea681da | 47 | .BR xterm (1), |
b218b023 | 48 | in which data read from the pseudoterminal master is interpreted by the |
fea681da MK |
49 | application in the same way |
50 | a real terminal would interpret the data, and for implementing remote-login | |
51 | programs such as | |
52 | .BR sshd (8), | |
b218b023 | 53 | in which data read from the pseudoterminal master is sent across the network |
fea681da MK |
54 | to a client program that is connected to a terminal or terminal emulator. |
55 | .PP | |
40a1b471 | 56 | Pseudoterminals can also be used to send input to programs that normally |
fea681da | 57 | refuse to read input from pipes (such as |
49ec013c | 58 | .BR su (1), |
fea681da | 59 | and |
49ec013c | 60 | .BR passwd (1)). |
fea681da MK |
61 | .SH FILES |
62 | .IR /dev/ptmx , | |
63 | .I /dev/pts/* | |
64 | .SH NOTES | |
b218b023 | 65 | The Linux support for the above (known as UNIX 98 pseudoterminal naming) |
fea681da MK |
66 | is done using the |
67 | .I devpts | |
a3d59075 | 68 | filesystem, which should be mounted on |
fea681da | 69 | .IR /dev/pts . |
47297adb | 70 | .SH SEE ALSO |
fea681da MK |
71 | .BR getpt (3), |
72 | .BR grantpt (3), | |
73 | .BR ptsname (3), | |
88ab292b MK |
74 | .BR unlockpt (3), |
75 | .BR pty (7) |