OSDN Git Service

(split) Import translated manuals from JM CVS Repository.
[linuxjm/LDP_man-pages.git] / original / man4 / pts.4
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\" This man page was written by Jeremy Phelps <jphelps@notreached.net>.
3 .\" Notes added - aeb
4 .\" Redistribute and revise at will.
5 .\"
6 .TH PTS 4 2002-10-09 "Linux" "Linux Programmer's Manual"
7 .SH NAME
8 ptmx, pts \- pseudo-terminal master and slave
9 .SH DESCRIPTION
10 The file \fI/dev/ptmx\fP is a character file with major number 5 and
11 minor number 2, usually of mode 0666 and owner.group of root.root.
12 It is used to create a pseudo-terminal master and slave pair.
13 .PP
14 When a process opens \fI/dev/ptmx\fP, it gets a file
15 descriptor for a pseudo-terminal master (PTM),
16 and a pseudo-terminal slave (PTS) device is created in the
17 .I /dev/pts
18 directory.
19 Each file descriptor obtained by opening \fI/dev/ptmx\fP
20 is an independent PTM with its own associated PTS, whose path can
21 be found by passing the descriptor to
22 .BR ptsname (3).
23 .PP
24 Before opening the pseudo-terminal slave, you must pass the master's file
25 descriptor to
26 .BR grantpt (3)
27 and
28 .BR unlockpt (3).
29 .PP
30 Once both the pseudo-terminal master and slave are open, the slave provides
31 processes with an interface that is identical to that of a real terminal.
32 .PP
33 Data written to the slave is presented on the master descriptor as input.
34 Data written to the master is presented to the slave as input.
35 .PP
36 In practice, pseudo-terminals are used for implementing terminal emulators
37 such as
38 .BR xterm (1),
39 in which data read from the pseudo-terminal master is interpreted by the
40 application in the same way
41 a real terminal would interpret the data, and for implementing remote-login
42 programs such as
43 .BR sshd (8),
44 in which data read from the pseudo-terminal master is sent across the network
45 to a client program that is connected to a terminal or terminal emulator.
46 .PP
47 Pseudo-terminals can also be used to send input to programs that normally
48 refuse to read input from pipes (such as
49 .BR su (1),
50 and
51 .BR passwd (1)).
52 .SH FILES
53 .IR /dev/ptmx ,
54 .I /dev/pts/*
55 .SH NOTES
56 The Linux support for the above (known as Unix98 pty naming)
57 is done using the
58 .I devpts
59 file system, that should be mounted on
60 .IR /dev/pts .
61 .LP
62 Before this Unix98 scheme, master ptys were called
63 .IR /dev/ptyp0 ", ..."
64 and slave ptys
65 .IR /dev/ttyp0 ", ..."
66 and one needed lots of preallocated device nodes.
67 .SH "SEE ALSO"
68 .BR getpt (3),
69 .BR grantpt (3),
70 .BR ptsname (3),
71 .BR unlockpt (3),
72 .BR pty (7)