1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\" This man page was written by Jeremy Phelps <jphelps@notreached.net>.
4 .\" Redistribute and revise at will.
6 .\" Japanese Version Copyright (c) 2003 Akihiro MOTOKI
7 .\" all rights reserved.
8 .\" Translated Tue Jul 8 00:28:17 JST 2003
9 .\" by Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
11 .\"WORD: pseudoterminal µ¼»÷üËö
14 .TH PTS 4 2002-10-09 "Linux" "Linux Programmer's Manual"
17 .\"O ptmx, pts \- pseudoterminal master and slave
18 ptmx, pts \- µ¼»÷üËö¤Î¥Þ¥¹¥¿¤È¥¹¥ì¡¼¥Ö
21 .\"O The file \fI/dev/ptmx\fP is a character file with major number 5 and
22 .\"O minor number 2, usually of mode 0666 and owner.group of root.root.
23 .\"O It is used to create a pseudoterminal master and slave pair.
24 ¥Õ¥¡¥¤¥ë \fI/dev/ptmx\fP ¤Ï¡¢¥á¥¸¥ã¡¼¥Ê¥ó¥Ð¡¼ (major number) 5¡¢
25 ¥Þ¥¤¥Ê¡¼¥Ê¥ó¥Ð¡¼ (minor number) 2 ¤ò»ý¤Ä¥¥ã¥é¥¯¥¿¡¦¥Õ¥¡¥¤¥ë¤Ç¤¢¤ê¡¢
26 Ä̾¥â¡¼¥É¤Ï 0666 ¤Ç¡¢½êͼÔ.¥°¥ë¡¼¥×¤Ï root.root ¤Ç¤¢¤ë¡£
27 ¤³¤Î¥Õ¥¡¥¤¥ë¤Ï¡¢µ¼»÷üËö (pseudoterminal) ¤Î¥Þ¥¹¥¿¤È¥¹¥ì¡¼¥Ö¤Î
28 ¥Ú¥¢¤òºîÀ®¤¹¤ë¤¿¤á¤Ë»ÈÍѤµ¤ì¤ë¡£
30 .\"O When a process opens \fI/dev/ptmx\fP, it gets a file
31 .\"O descriptor for a pseudoterminal master (PTM),
32 .\"O and a pseudoterminal slave (PTS) device is created in the
35 .\"O Each file descriptor obtained by opening \fI/dev/ptmx\fP
36 .\"O is an independent PTM with its own associated PTS, whose path can
37 .\"O be found by passing the descriptor to
39 ¥×¥í¥»¥¹¤¬ \fI/dev/ptmx\fP ¤ò¥ª¡¼¥×¥ó¤¹¤ë¤È¡¢¤½¤Î¥×¥í¥»¥¹¤Ë¤Ï
40 µ¼»÷üËö¥Þ¥¹¥¿ (pseudoterminal master; PTM) ¤Ø¤Î¥Õ¥¡¥¤¥ë¡¦
41 ¥Ç¥£¥¹¥¯¥ê¥×¥¿¤¬ÊÖ¤µ¤ì¡¢
43 ¥Ç¥£¥ì¥¯¥È¥ê¤Ëµ¼»÷üËö¥¹¥ì¡¼¥Ö (pseudoterminal slave; PTS)
44 ¥Ç¥Ð¥¤¥¹¤¬ºîÀ®¤µ¤ì¤ë¡£
45 \fI/dev/ptmx\fP ¤ò¥ª¡¼¥×¥ó¤·¤ÆÆÀ¤é¤ì¤ë¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ï
46 ¤½¤ì¤¾¤ìÆÈΩ¤Î PTM ¤Ç¤¢¤ê¡¢Âбþ¤¹¤ë PTS ¤ò³Æ¡¹»ý¤Ä¡£
47 PTS ¤Î¥Ñ¥¹Ì¾¤Ï¡¢PTM ¤Î¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¤ò
49 ¤ËÅϤ¹¤ÈÃΤ뤳¤È¤¬¤Ç¤¤ë¡£
51 .\"O Before opening the pseudoterminal slave, you must pass the master's file
55 .\"O .BR unlockpt (3).
56 µ¼»÷üËö¥¹¥ì¡¼¥Ö¤ò¥ª¡¼¥×¥ó¤¹¤ëÁ°¤Ë¡¢É¬¤º¡¢¥Þ¥¹¥¿¤Î¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¤ò
61 ¤ò¸Æ¤Ó½Ð¤µ¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
63 .\"O Once both the pseudoterminal master and slave are open, the slave provides
64 .\"O processes with an interface that is identical to that of a real terminal.
65 µ¼»÷üËö¤Î¥Þ¥¹¥¿¤È¥¹¥ì¡¼¥Ö¤ÎξÊý¤¬¥ª¡¼¥×¥ó¤µ¤ì¤¿¸å¤Ï¡¢¥¹¥ì¡¼¥Ö¤Ï¡¢
66 ¥×¥í¥»¥¹¤ËÂФ·¤Æ¡¢¼ÂüËö (real terminal) ¤ÈÁ´¤¯Æ±¤¸¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤òÄ󶡤¹¤ë¡£
68 .\"O Data written to the slave is presented on the master descriptor as input.
69 .\"O Data written to the master is presented to the slave as input.
70 ¥¹¥ì¡¼¥Ö¤Ë½ñ¤«¤ì¤¿¥Ç¡¼¥¿¤Ï¥Þ¥¹¥¿¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¤ËÂФ¹¤ëÆþÎϤȤ·¤Æ°·¤ï¤ì¡¢
71 ¥Þ¥¹¥¿¤Ë½ñ¤«¤ì¤¿¥Ç¡¼¥¿¤Ï¥¹¥ì¡¼¥Ö¤ËÂФ¹¤ëÆþÎϤȤ·¤Æ°·¤ï¤ì¤ë¡£
73 .\"O In practice, pseudoterminals are used for implementing terminal emulators
76 .\"O in which data read from the pseudoterminal master is interpreted by the
77 .\"O application in the same way
78 .\"O a real terminal would interpret the data, and for implementing remote-login
81 .\"O in which data read from the pseudoterminal master is sent across the network
82 .\"O to a client program that is connected to a terminal or terminal emulator.
83 ¼ÂÎã¤ò¤¢¤²¤ë¤È¡¢µ¼»÷üËö¤Ï
85 ¤Î¤è¤¦¤ÊüËö¥¨¥ß¥å¥ì¡¼¥¿¤ò¼ÂÁõ¤¹¤ë¤Î¤Ë»ÈÍѤµ¤ì¤Æ¤¤¤ë¡£
86 üËö¥¨¥ß¥å¥ì¡¼¥¿¤Ç¤Ï¡¢µ¼»÷üËö¤Î¥Þ¥¹¥¿¤«¤éÆɤ߹þ¤Þ¤ì¤¿¥Ç¡¼¥¿¤Ï¡¢
87 ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ë¤È¤Ã¤Æ¼ÂüËö¤Î¥Ç¡¼¥¿¤ÈÁ´¤¯Æ±¤¸¤â¤Î¤Î¤è¤¦¤Ë¸«¤¨¤ë¡£
90 ¤Î¤è¤¦¤Ê¥ê¥â¡¼¥È¡¦¥í¥°¥¤¥óÍÑ¤Î¥×¥í¥°¥é¥à¤Î¼ÂÁõ¤Ç¤Ï¡¢
91 µ¼»÷üËö¥Þ¥¹¥¿¤«¤éÆɤ߹þ¤Þ¤ì¤¿¥Ç¡¼¥¿¤Ï¡¢¥Í¥Ã¥È¥ï¡¼¥¯¤ò·Ðͳ¤·¤Æ¡¢
92 üËö¤äüËö¥¨¥ß¥å¥ì¡¼¥¿¤ËÀܳ¤µ¤ì¤Æ¤¤¤ë¥¯¥é¥¤¥¢¥ó¥È¡¦¥×¥í¥°¥é¥à¤ËÁ÷¿®¤µ¤ì¤ë¡£
94 .\"O Pseudoterminals can also be used to send input to programs that normally
95 .\"O refuse to read input from pipes (such as
103 ¤Î¤è¤¦¤Ê) Ä̾ï¤Ï¥Ñ¥¤¥×¤«¤é¤ÎÆþÎϤòµñÈݤ¹¤ë¥×¥í¥°¥é¥à¤Ë¡¢
104 ÆþÎϤòÁ÷¿®¤¹¤ë¤¿¤á¤Ë¤â»ÈÍѤǤ¤ë¡£
111 .\"O The Linux support for the above (known as UNIX 98 pseudoterminal naming)
112 .\"O is done using the
114 .\"O file system, that should be mounted on
116 (UNIX 98 pseudoterminal naming ¤È¸Æ¤Ð¤ì¤ë)
117 ¾åµ¤Îµ¡Ç½¤Î Linux ¤Ç¤Î¥µ¥Ý¡¼¥È¤Ï¡¢Ä̾ï
119 ¤Ë¥Þ¥¦¥ó¥È¤µ¤ì¤ë¤Ï¤º¤Î
121 ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤òÄ̤·¤Æ¼Â¸½¤µ¤ì¤Æ¤¤¤ë¡¢
123 .\"O Before this UNIX 98 scheme, master pseudoterminals were called
124 .\"O .IR /dev/ptyp0 ", ..."
125 .\"O and slave pseudoterminals
126 .\"O .IR /dev/ttyp0 ", ..."
127 .\"O and one needed lots of preallocated device nodes.
128 ¤³¤Î UNIX 98 ¥¹¥¡¼¥à¤¬Æ³Æþ¤µ¤ì¤ëÁ°¤Ï¡¢¥Þ¥¹¥¿µ¼»÷üËö¤Ï
129 .IR /dev/ptyp0 ", ..."
131 .IR /dev/ttyp0 ", ..."
132 ¤È¸Æ¤Ð¤ì¤Æ¤ª¤ê¡¢¤¢¤é¤«¤¸¤á¤¿¤¯¤µ¤ó¤Î¥Ç¥Ð¥¤¥¹¡¦¥Î¡¼¥É¤ò³ä¤êÅö¤Æ¤Æ