1 .\" Copyright 2002 Walter Harms <walter.harms@informatik.uni-oldenburg.de>
2 .\" and Andries Brouwer <aeb@cwi.nl>.
3 .\" Distributed under GPL.
5 .\" Japanese Version Copyright (c) 2004 Yuichi SATO
6 .\" all rights reserved.
7 .\" Translated Sat Oct 16 06:08:24 JST 2004
8 .\" by Yuichi SATO <ysato444@yahoo.co.jp>
10 .TH TTY_IOCTL 4 2008-10-29 "Linux" "Linux Programmer's Manual"
13 .\"O tty_ioctl \- ioctls for terminals and serial lines
14 tty_ioctl \- üËö¤È¥·¥ê¥¢¥ë¥é¥¤¥ó¤Î ioctl (Æþ½ÐÎÏÀ©¸æ)
17 .B "#include <termios.h>"
19 .BI "int ioctl(int " fd ", int " cmd ", ...);"
24 .\"O call for terminals and serial ports accepts many possible command arguments.
25 üËö¤È¥·¥ê¥¢¥ë¥Ý¡¼¥È¤Ë¤Ä¤¤¤Æ¤Î
27 ¥³¡¼¥ë¤Ï¡¢Â¿¤¯¤Î¥³¥Þ¥ó¥É°ú¤¿ô¤ò¼õ¤±ÉÕ¤±¤ë¡£
28 .\"O Most require a third argument, of varying type, here called \fIargp\fP
30 ¿¤¯¤¬¤¤¤í¤¤¤í¤Ê·¿¤Î 3 ÈÖÌܤΰú¤¿ô¤òɬÍפȤ¹¤ë¡£
31 ¤³¤³¤Ç¤Ï \fIargp\fP ¤Þ¤¿¤Ï \fIarg\fP ¤È¸Æ¤Ö¡£
35 .\"O makes for nonportable programs.
36 .\"O Use the POSIX interface described in
38 .\"O whenever possible.
40 ¤ò»ÈÍѤ¹¤ë¤È°Ü¿¢À¤Î¤Ê¤¤¥×¥í¥°¥é¥à¤Ë¤Ê¤ë¡£
43 ¤Ëµ½Ò¤µ¤ì¤Æ¤¤¤ë POSIX ¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤ò»È¤¦¤³¤È¡£
44 .\"O .SS "Get and Set Terminal Attributes"
45 .SS üËö°À¤Î¼èÆÀ¤ÈÀßÄê
47 .BI "TCGETS struct termios *" argp
49 .\"O .IR "tcgetattr(fd, argp)" .
50 .I "tcgetattr(fd, argp)"
53 .\"O Get the current serial port settings.
54 ¸½ºß¤Î¥·¥ê¥¢¥ë¥Ý¡¼¥È¤ÎÀßÄê¤ò¼èÆÀ¤¹¤ë¡£
56 .BI "TCSETS const struct termios *" argp
58 .\"O .IR "tcsetattr(fd, TCSANOW, argp)" .
59 .I "tcsetattr(fd, TCSANOW, argp)"
62 .\"O Set the current serial port settings.
63 ¸½ºß¤Î¥·¥ê¥¢¥ë¥Ý¡¼¥È¤ÎÀßÄê¤òÊѹ¹¤¹¤ë¡£
65 .BI "TCSETSW const struct termios *" argp
67 .\"O .IR "tcsetattr(fd, TCSADRAIN, argp)" .
68 .I "tcsetattr(fd, TCSADRAIN, argp)"
71 .\"O Allow the output buffer to drain, and
72 .\"O set the current serial port settings.
73 ÇӽР(drain) ¤ò¹Ô¤¦¤¿¤á¤Î½ÐÎϥХåե¡¤Î»ÈÍѤòµö²Ä¤·¡¢
74 ¸½ºß¤Î¥·¥ê¥¢¥ë¥Ý¡¼¥È¤ÎÀßÄê¤òÊѹ¹¤¹¤ë¡£
76 .BI "TCSETSF const struct termios *" argp
78 .\"O .IR "tcsetattr(fd, TCSAFLUSH, argp)" .
79 .I "tcsetattr(fd, TCSAFLUSH, argp)"
82 .\"O Allow the output buffer to drain, discard pending input, and
83 .\"O set the current serial port settings.
84 ÇӽР(drain) ¤ò¹Ô¤¦¤¿¤á¤Î½ÐÎϥХåե¡¤Î»ÈÍѤòµö²Ä¤·¡¢
85 ½èÍý¤·¤Æ¤¤¤Ê¤¤ÆþÎϤòÇË´þ¤·¤Æ¡¢
86 ¸½ºß¤Î¥·¥ê¥¢¥ë¥Ý¡¼¥È¤ÎÀßÄê¤òÊѹ¹¤¹¤ë¡£
88 .\"O The following four ioctls are just like
93 .\"O except that they take a
94 .\"O .I "struct termio *"
96 .\"O .IR "struct termios *" .
97 °Ê²¼¤Î 4 ¤Ä¤Î ioctl ¤Ï
104 .I "struct termios *"
109 .BI "TCGETA struct termio *" argp
111 .BI "TCSETA const struct termio *" argp
113 .BI "TCSETAW const struct termio *" argp
115 .BI "TCSETAF const struct termio *" argp
116 .\"O .SS "Locking the termios structure"
117 .SS "termios ¹½Â¤ÂΤΥí¥Ã¥¯"
120 .\"O structure of a terminal can be locked.
121 .\"O The lock is itself a
123 .\"O structure, with nonzero bits or fields indicating a
127 ¹½Â¤ÂΤϥí¥Ã¥¯¤¹¤ë¤³¤È¤¬²Äǽ¤Ç¤¢¤ë¡£
131 0 ¤Ç¤Ê¤¤¥Ó¥Ã¥È¤Þ¤¿¤Ï¥Õ¥£¡¼¥ë¥É¤Ï¥í¥Ã¥¯¤µ¤ì¤¿Ãͤò¼¨¤¹¡£
133 .BI "TIOCGLCKTRMIOS struct termios *" argp
134 .\"O Gets the locking status of the
136 .\"O structure of the terminal.
139 ¹½Â¤ÂΤΥí¥Ã¥¯¾õÂÖ¤ò¼èÆÀ¤¹¤ë¡£
141 .BI "TIOCSLCKTRMIOS const struct termios *" argp
142 .\"O Sets the locking status of the
144 .\"O structure of the terminal.
145 .\"O Only root (more precisely: a process with the
146 .\"O .BR CAP_SYS_ADMIN
147 .\"O capability) can do this.
150 ¹½Â¤ÂΤΥí¥Ã¥¯¾õÂÖ¤òÀßÄꤹ¤ë¡£
151 root ¤Î¤ß (¤è¤êÀµ³Î¤Ë¤Ï¡¢
153 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò»ý¤Ä¥×¥í¥»¥¹) ¤¬¤³¤ì¤ò¼Â¹Ô¤Ç¤¤ë¡£
154 .\"O .SS "Get and Set Window Size"
155 .SS ¥¦¥£¥ó¥É¥¦¥µ¥¤¥º¤Î¼èÆÀ¤ÈÀßÄê
156 .\"O Window sizes are kept in the kernel, but not used by the kernel
157 .\"O (except in the case of virtual consoles, where the kernel will
158 .\"O update the window size when the size of the virtual console changes,
159 .\"O for example, by loading a new font).
160 ¥¦¥£¥ó¥É¥¦¥µ¥¤¥º¤Ï¥«¡¼¥Í¥ëÆâ¤ËÊÝ»ý¤µ¤ì¤ë¤¬¡¢
161 ¥«¡¼¥Í¥ë¤Ë¤è¤Ã¤Æ»ÈÍѤµ¤ì¤Ê¤¤
162 (²¾ÁÛ¥³¥ó¥½¡¼¥ë¤Î¾ì¹ç¤ÏÎã³°¤Ç¤¢¤ê¡¢¿·¤·¤¤¥Õ¥©¥ó¥È¤òÆɤ߹þ¤ó¤À¾ì¹ç¤Ê¤É¡¢
163 ²¾ÁÛüËö¤Î¥µ¥¤¥º¤¬Êѹ¹¤µ¤ì¤¿¾ì¹ç¡¢¥«¡¼¥Í¥ë¤Ï¥¦¥£¥ó¥É¥¦¥µ¥¤¥º¤ò¹¹¿·¤¹¤ë)¡£
165 .\"O The following constants and structure are defined in
166 .\"O .IR <sys/ioctl.h> .
171 .BI "TIOCGWINSZ struct winsize *" argp
172 .\"O Get window size.
173 ¥¦¥£¥ó¥É¥¦¥µ¥¤¥º¤ò¼èÆÀ¤¹¤ë¡£
175 .BI "TIOCSWINSZ const struct winsize *" argp
176 .\"O Set window size.
177 ¥¦¥£¥ó¥É¥¦¥µ¥¤¥º¤òÀßÄꤹ¤ë¡£
179 .\"O The struct used by these ioctls is defined as
180 ¤³¤ì¤é¤Î ioctl ¤Ç»ÈÍѤµ¤ì¤ë¹½Â¤ÂΤϡ¢°Ê²¼¤Î¤è¤¦¤ËÄêµÁ¤µ¤ì¤ë¡£
185 unsigned short ws_row;
186 unsigned short ws_col;
187 .\"O unsigned short ws_xpixel; /* unused */
188 .\"O unsigned short ws_ypixel; /* unused */
189 unsigned short ws_xpixel; /* ̤»ÈÍÑ */
190 unsigned short ws_ypixel; /* ̤»ÈÍÑ */
195 .\"O When the window size changes, a
197 .\"O signal is sent to the
198 .\"O foreground process group.
199 ¥¦¥£¥ó¥É¥¦¥µ¥¤¥º¤¬Êѹ¹¤µ¤ì¤¿¾ì¹ç¡¢
200 ¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Ë
203 .\"O .SS "Sending a Break"
206 .BI "TCSBRK int " arg
208 .\"O .IR "tcsendbreak(fd, arg)" .
209 .I "tcsendbreak(fd, arg)"
212 .\"O If the terminal is using asynchronous serial data transmission, and
214 .\"O is zero, then send a break (a stream of zero bits) for between
215 .\"O 0.25 and 0.5 seconds.
216 .\"O If the terminal is not using asynchronous
217 .\"O serial data transmission, then either a break is sent, or the function
218 .\"O returns without doing anything.
219 üËö¤¬ÈóƱ´ü¥·¥ê¥¢¥ë¥Ç¡¼¥¿Å¾Á÷¤ò»ÈÍѤ·¤Æ¤ª¤ê¡¢
221 ¤¬ 0 ¤Î¾ì¹ç¡¢0.25 ¤«¤é 0.5 Éäδ֤Ë
222 break (0 ¤Î¥Ó¥Ã¥ÈÎó¤Î¥¹¥È¥ê¡¼¥à) ¤¬Á÷¿®¤µ¤ì¤ë¡£
223 üËö¤¬ÈóƱ´ü¥·¥ê¥¢¥ë¥Ç¡¼¥¿Å¾Á÷¤ò»ÈÍѤ·¤Æ¤¤¤ë¾ì¹ç¡¢
224 break ¤¬Á÷¿®¤µ¤ì¤ë¤«¡¢¤³¤Î´Ø¿ô¤Ï²¿¤â¤»¤º¤ËÊ֤롣
227 .\"O is nonzero, nobody knows what will happen.
229 ¤¬ 0 °Ê³°¤Î¾ì¹ç¡¢²¿¤¬µ¯¤³¤ë¤«Ê¬¤«¤é¤Ê¤¤¡£
231 .\"O (SVr4, UnixWare, Solaris, Linux treat
232 .\"O .I "tcsendbreak(fd,arg)"
236 .\"O .IR "tcdrain(fd)" .
237 (SVr4, UnixWare, Solaris, Linux ¤Ï¡¢
238 .I "tcsendbreak(fd,arg)"
246 .\"O as a multiplier, and sends a stream of bits
248 .\"O times as long as done for zero
252 ¤òÇÜ¿ô¤È¤·¤Æ°·¤¤¡¢¥Ó¥Ã¥È¤Î¥¹¥È¥ê¡¼¥à¤ò
257 .\"O DG/UX and AIX treat
259 .\"O (when nonzero) as a time interval measured in milliseconds.
260 DG/UX ¤È AIX ¤Ï¡¢(0 °Ê³°¤Î¾ì¹ç)
262 ¤ò¥ß¥êÉÃñ°Ì¤Î»þ´Ö´Ö³Ö¤È¤·¤Æ°·¤¦¡£
269 .BI "TCSBRKP int " arg
270 .\"O So-called "POSIX version" of
272 .\"O It treats nonzero
274 .\"O as a timeinterval measured in deciseconds, and does nothing
275 .\"O when the driver does not support breaks.
276 ¤¤¤ï¤æ¤ë¡ÖPOSIX ÈǡפÎ
281 ¤ò 1/10 ÉÃñ°Ì¤Î»þ´Ö´Ö³Ö¤È¤·¤Æ°·¤¦¡£
282 ¤Þ¤¿¥É¥é¥¤¥Ð¤¬ break ¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¡¢²¿¤â¤·¤Ê¤¤¡£
285 .\"O Turn break on, that is, start sending zero bits.
287 ¤Ä¤Þ¤ê 0 ¤Î¥Ó¥Ã¥ÈÎó¤ÎÁ÷¿®¤ò³«»Ï¤¹¤ë¡£
290 .\"O Turn break off, that is, stop sending zero bits.
292 ¤Ä¤Þ¤ê 0 ¤Î¥Ó¥Ã¥ÈÎó¤ÎÁ÷¿®¤òÄä»ß¤¹¤ë¡£
293 .\"O .SS "Software flow control"
294 .SS ¥½¥Õ¥È¥¦¥§¥¢¥Õ¥í¡¼À©¸æ
296 .BI "TCXONC int " arg
298 .\"O .IR "tcflow(fd, arg)" .
304 .\"O for the argument values
316 .\"O .SS "Buffer count and flushing"
317 .SS "¥Ð¥Ã¥Õ¥¡¤Î¥«¥¦¥ó¥È¤È½ñ¤½Ð¤· (flush)"
319 .BI "FIONREAD int *" argp
320 .\"O Get the number of bytes in the input buffer.
321 ÆþÎϥХåե¡¤Ë¤¢¤ë¥Ð¥¤¥È¿ô¤ò¼èÆÀ¤¹¤ë¡£
323 .BI "TIOCINQ int *" argp
329 .BI "TIOCOUTQ int *" argp
330 .\"O Get the number of bytes in the output buffer.
331 ½ÐÎϥХåե¡¤Ë¤¢¤ë¥Ð¥¤¥È¿ô¤ò¼èÆÀ¤¹¤ë¡£
333 .BI "TCFLSH int " arg
335 .\"O .IR "tcflush(fd, arg)" .
336 .I "tcflush(fd, arg)"
341 .\"O for the argument values
351 .\"O .SS "Faking input"
354 .BI "TIOCSTI const char *" argp
355 .\"O Insert the given byte in the input queue.
356 »ØÄꤵ¤ì¤¿¥Ð¥¤¥È¤òÆþÎÏ¥¥å¡¼¤ËÁÞÆþ¤¹¤ë¡£
357 .\"O .SS "Redirecting console output"
358 .SS ¥³¥ó¥½¡¼¥ë½ÐÎϤΥê¥À¥¤¥ì¥¯¥È
361 .\"O Redirect output that would have gone to
365 .\"O to the given terminal.
366 .\"O If that was a pseudoterminal master, send it to the slave.
370 ¤ËÁ÷¤é¤ì¤ë½ÐÎϤò¡¢»ØÄꤵ¤ì¤¿Ã¼Ëö¥ê¥À¥¤¥ì¥¯¥È¤¹¤ë¡£
371 »ØÄꤵ¤ì¤¿Ã¼Ëö¤¬µ¿»÷üËö (pseudoterminal) ¤Î¥Þ¥¹¥¿¤Î¾ì¹ç¡¢
372 ½ÐÎϤϥ¹¥ì¡¼¥Ö¤ËÁ÷¤é¤ì¤ë¡£
373 .\"O In Linux before version 2.6.10,
374 .\"O anybody can do this as long as the output was not redirected yet;
375 .\"O since version 2.6.10, only root (a process with the
376 .\"O .BR CAP_SYS_ADMIN
377 .\"O capability) may do this.
378 ¥Ð¡¼¥¸¥ç¥ó 2.6.10 ¤è¤êÁ°¤Î Linux ¤Ç¤Ï¡¢½ÐÎϤ¬¤Þ¤À¥ê¥À¥¤¥ì¥¯¥È¤µ¤ì¤Æ
379 ¤¤¤Ê¤±¤ì¤Ð¡¢Ã¯¤Ç¤â¥ê¥À¥¤¥ì¥¯¥È¤ò¹Ô¤¦¤³¤È¤¬¤Ç¤¤ë¡£
380 ¥Ð¡¼¥¸¥ç¥ó 2.6.10 °Ê¹ß¤Ç¤Ï¡¢root
382 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò»ý¤Ä¥×¥í¥»¥¹) ¤À¤±¤¬¥ê¥À¥¤¥ì¥¯¥È¤ò¹Ô¤¦¤³¤È¤¬¤Ç¤¤ë¡£
383 .\"O If output was redirected already
386 .\"O but redirection can be stopped by using this ioctl with
392 ½ÐÎϤ¬¤¹¤Ç¤Ë¥ê¥À¥¤¥ì¥¯¥È¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï
400 ¤ËÂФ·¤Æ¤³¤Î ioctl ¤ò»ÈÍѤ¹¤ë¤³¤È¤Ç¡¢¥ê¥À¥¤¥ì¥¯¥È¤ò»ß¤á¤ë¤³¤È¤¬¤Ç¤¤ë¡£
401 .\"O .SS "Controlling terminal"
404 .BI "TIOCSCTTY int " arg
405 .\"O Make the given terminal the controlling terminal of the calling process.
406 »ØÄꤵ¤ì¤¿Ã¼Ëö¤ò¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥»¥¹¤ÎÀ©¸æüËö¤Ë¤¹¤ë¡£
407 .\"O The calling process must be a session leader and not have a
408 .\"O controlling terminal already.
409 .\"O If this terminal is already the controlling terminal
410 .\"O of a different session group then the ioctl fails with
412 .\"O unless the caller is root (more precisely: has the
413 .\"O .BR CAP_SYS_ADMIN
416 .\"O equals 1, in which case the terminal is stolen, and all processes that had
417 .\"O it as controlling terminal lose it.
418 ¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥»¥¹¤Ï¥»¥Ã¥·¥ç¥ó¥ê¡¼¥À¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤º¡¢
419 ¤«¤Ä´û¤ËÀ©¸æüËö¤ò»ý¤Ã¤Æ¤¤¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
420 ¤³¤ÎüËö¤¬´û¤Ë¾¤Î¥»¥Ã¥·¥ç¥ó¥°¥ë¡¼¥×¤ÎÀ©¸æüËö¤Ç¤¢¤ë¾ì¹ç¡¢
423 ¤Ç¼ºÇÔ¤¹¤ë¡£¤¿¤À¤·¸Æ¤Ó½Ð¤·¤¿¥æ¡¼¥¶¤¬ root ¤Ç
426 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò»ý¤Ã¤Æ¤¤¤Æ)¡¢¤«¤Ä
428 ¤¬ 1 ¤Ç¤¢¤ë¾ì¹ç¤ò½ü¤¯¡£
429 ¤³¤Î¾ì¹ç¡¢Ã¼Ëö¤ÏÅð¤Þ¤ì (stolen)¡¢
430 ¤³¤ÎüËö¤òÀ©¸æüËö¤È¤·¤Æ¤¤¤¿Á´¤Æ¤Î¥×¥í¥»¥¹¤ÏüËö¤ò¼º¤¦¡£
433 .\"O If the given terminal was the controlling terminal of the calling process,
434 .\"O give up this controlling terminal.
435 .\"O If the process was session leader,
440 .\"O to the foreground process group
441 .\"O and all processes in the current session lose their controlling terminal.
442 »ØÄꤵ¤ì¤¿Ã¼Ëö¤¬¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥»¥¹¤ÎÀ©¸æüËö¤Ç¤¢¤ë¾ì¹ç¡¢
443 ¤³¤ÎÀ©¸æüËö¤òÊü´þ¤¹¤ë¡£
444 ¥×¥í¥»¥¹¤¬¥»¥Ã¥·¥ç¥ó¥ê¡¼¥À¤Î¾ì¹ç¡¢
445 ¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Ë
449 ¤òÁ÷¤ê¡¢¥«¥ì¥ó¥È¥»¥Ã¥·¥ç¥ó¤ÎÁ´¤Æ¤Î¥×¥í¥»¥¹¤ÏÀ©¸æüËö¤ò¼º¤¦¡£
450 .\"O .SS "Process group and session ID"
451 .SS "¥°¥ë¡¼¥× ID ¤È¥»¥Ã¥·¥ç¥ó ID ¤Î½èÍý"
453 .BI "TIOCGPGRP pid_t *" argp
454 .\"O When successful, equivalent to
455 .\"O .IR "*argp = tcgetpgrp(fd)" .
457 .I "*argp = tcgetpgrp(fd)"
460 .\"O Get the process group ID of the foreground process group on this terminal.
461 ¤³¤ÎüËö¾å¤Î¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¥×¥í¥»¥¹¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥× ID ¤ò¼èÆÀ¤¹¤ë¡£
463 .BI "TIOCSPGRP const pid_t *" argp
465 .\"O .IR "tcsetpgrp(fd, *argp)" .
466 .I "tcsetpgrp(fd, *argp)"
469 .\"O Set the foreground process group ID of this terminal.
470 ¤³¤ÎüËö¤Î¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¥×¥í¥»¥¹¤Î¥°¥ë¡¼¥× ID ¤òÀßÄꤹ¤ë¡£
472 .BI "TIOCGSID pid_t *" argp
473 .\"O Get the session ID of the given terminal.
474 .\"O This will fail with
476 .\"O in case the terminal is not a master pseudoterminal
477 .\"O and not our controlling terminal.
479 »ØÄꤵ¤ì¤¿Ã¼Ëö¤Î¥»¥Ã¥·¥ç¥ó ID ¤ò¼èÆÀ¤¹¤ë¡£
480 üËö¤¬¥Þ¥¹¥¿µ¿»÷üËö¤Þ¤¿¤ÏÀ©¸æüËö¤Ç¤Ê¤¤¾ì¹ç¤Ï¡¢
484 .\"O .SS "Exclusive mode"
488 .\"O Put the terminal into exclusive mode.
491 .\"O operations on the terminal are permitted.
492 .\"O (They will fail with
494 .\"O except for root, that is, a process with the
495 .\"O .BR CAP_SYS_ADMIN
497 üËö¤òÇÓ¾¥â¡¼¥É¤Ë¤¹¤ë¡£
498 üËö¤ËÂФ·¤Æ¡¢¤³¤ì°Ê¹ß¤Î
501 (root °Ê³°¤Î¾ì¹ç¡¢¤Ä¤Þ¤ê
503 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò»ý¤¿¤Ê¤¤¥×¥í¥»¥¹¤Î¾ì¹ç¡¢¤³¤ì°Ê¹ß¤Î
510 .\"O Disable exclusive mode.
511 ÇÓ¾¥â¡¼¥É¤ò̵¸ú¤Ë¤¹¤ë¡£
512 .\"O .SS "Line discipline"
513 .SS "¥é¥¤¥óÀ©¸æ (line discipline)"
515 .BI "TIOCGETD int *" argp
516 .\"O Get the line discipline of the terminal.
517 üËö¤Î¥é¥¤¥óÀ©¸æ¤Î¾ðÊó¤ò¼èÆÀ¤¹¤ë¡£
519 .BI "TIOCSETD const int *" argp
520 .\"O Set the line discipline of the terminal.
521 üËö¤Î¥é¥¤¥óÀ©¸æ¤Î¾ðÊó¤òÀßÄꤹ¤ë¡£
522 .\"O .SS "Pseudoterminal ioctls"
523 .SS "µ¿»÷üËö¤Î ioctl"
525 .BI "TIOCPKT const int *" argp
528 .\"O is nonzero) or disable packet mode.
531 ¤¬ 0 °Ê³°¤Î¾ì¹ç) ¤Þ¤¿¤Ï̵¸ú¤Ë¤¹¤ë¡£
532 .\"O Can be applied to the master side of a pseudoterminal only (and will return
535 .\"O In packet mode, each subsequent
537 .\"O will return a packet that either contains a single nonzero control byte,
538 .\"O or has a single byte containing zero (\(aq\0\(aq) followed by data
539 .\"O written on the slave side of the pseudoterminal.
540 .\"O If the first byte is not
542 .\"O (0), it is an OR of one
543 .\"O or more of the following bits:
544 µ¿»÷üËö¤Î¥Þ¥¹¥¿Â¦¤Ë¤Î¤ßŬÍѤǤ¤ë (¤½¤ì°Ê³°¤Î¾ì¹ç¤Ï
547 ¥Ñ¥±¥Ã¥È¥â¡¼¥É¤Ç¤Ï¡¢¤½¤Î¸å¤Ë¼Â¹Ô¤µ¤ì¤ë
549 ¤Ï¡¢Ãͤ¬ 0 °Ê³°¤Î 1 ¤Ä¤ÎÀ©¸æ¥Ð¥¤¥È¤ò´Þ¤à¥Ñ¥±¥Ã¥È¤«¡¢
550 Ãͤ¬ 0 ¤Î 1 ¥Ð¥¤¥È (\(aq\\0\(aq) ¤Ëµ¿»÷üËö¤Î¥¹¥ì¡¼¥Ö¦¤Ç½ñ¤¹þ¤Þ¤ì¤¿
551 ¥Ç¡¼¥¿¤¬Â³¤¯¥Ñ¥±¥Ã¥È¤òÊÖ¤¹¡£
554 (0) ¤Ç¤Ê¤¤¾ì¹ç¡¢°Ê²¼¤Î¥Ó¥Ã¥È¤Î 1 ¤Ä°Ê¾å¤ò OR ¤·¤¿¤â¤Î¤Ç¤¢¤ë:
557 .\"O TIOCPKT_FLUSHREAD The read queue for the terminal is flushed.
558 TIOCPKT_FLUSHREAD üËö¤ÎÆɤ߹þ¤ß¥¥å¡¼¤¬¥Õ¥é¥Ã¥·¥å (flush) ¤µ¤ì¤ë¡£
559 .\"O TIOCPKT_FLUSHWRITE The write queue for the terminal is flushed.
560 TIOCPKT_FLUSHWRITE üËö¤Î½ñ¤½Ð¤·¥¥å¡¼¤¬¥Õ¥é¥Ã¥·¥å¤µ¤ì¤ë¡£
561 .\"O TIOCPKT_STOP Output to the terminal is stopped.
562 TIOCPKT_STOP üËö¤Ø¤Î½ÐÎϤ¬Ää»ß¤µ¤ì¤ë¡£
563 .\"O TIOCPKT_START Output to the terminal is restarted.
564 TIOCPKT_START üËö¤Ø¤Î½ÐÎϤ¬ºÆ³«¤µ¤ì¤ë¡£
565 .\"O TIOCPKT_DOSTOP The start and stop characters are \fB^S\fP/\fB^Q\fP.
566 .\"O TIOCPKT_NOSTOP The start and stop characters are not \fB^S\fP/\fB^Q\fP.
567 TIOCPKT_DOSTOP ³«»Ïʸ»ú¤È½ªÎ»Ê¸»ú¤¬ \fB^S\fP/\fB^Q\fP ¤Ç¤¢¤ë¡£
568 TIOCPKT_NOSTOP ³«»Ïʸ»ú¤È½ªÎ»Ê¸»ú¤¬ \fB^S\fP/\fB^Q\fP ¤Ç¤Ê¤¤¡£
571 .\"O While this mode is in use, the presence
572 .\"O of control status information to be read
573 .\"O from the master side may be detected by a
575 .\"O for exceptional conditions.
576 ¤³¤Î¥â¡¼¥É¤¬»È¤ï¤ì¤Æ¤¤¤ë¾ì¹ç¡¢
577 À©¸æ¾õÂÖ¾ðÊó¤Î¸ºß¤¬¥Þ¥¹¥¿Â¦¤«¤éÆɤ߹þ¤á¤ë¤«¤Ï¡¢
580 ¤ò»È¤¦¤³¤È¤Ë¤è¤êÃΤ뤳¤È¤¬¤Ç¤¤ë¡£
582 .\"O This mode is used by
586 .\"O to implement a remote-echoed,
587 .\"O locally \fB^S\fP/\fB^Q\fP flow-controlled remote login.
592 ¤Ç»È¤ï¤ì¡¢¥ê¥â¡¼¥È¥¨¥³¡¼¤Î¥ê¥â¡¼¥È¥í¥°¥¤¥ó¤È
593 ¥í¡¼¥«¥ë¤Ç¤Î \fB^S\fP/\fB^Q\fP ¥Õ¥í¡¼À©¸æ¤Î¥ê¥â¡¼¥È¥í¥°¥¤¥ó¤ò¼ÂÁõ¤·¤Æ¤¤¤ë¡£
600 .\"O have not been implemented under Linux.
606 ¤Ï¡¢Linux ¤Ç¤Ï¼ÂÁõ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
607 .\"O .SS "Modem control"
610 .BI "TIOCMGET int *" argp
611 .\"O get the status of modem bits.
612 ¥â¥Ç¥à¥Ó¥Ã¥ÈÎó¤Î¾õÂÖ¤ò¼èÆÀ¤¹¤ë¡£
614 .BI "TIOCMSET const int *" argp
615 .\"O set the status of modem bits.
616 ¥â¥Ç¥à¥Ó¥Ã¥ÈÎó¤Î¾õÂÖ¤òÀßÄꤹ¤ë¡£
618 .BI "TIOCMBIC const int *" argp
619 .\"O clear the indicated modem bits.
620 »ØÄꤵ¤ì¤¿¥â¥Ç¥à¥Ó¥Ã¥ÈÎó¤ò¥¯¥ê¥¢¤¹¤ë¡£
622 .BI "TIOCMBIS const int *" argp
623 .\"O set the indicated modem bits.
624 »ØÄꤵ¤ì¤¿¥â¥Ç¥à¥Ó¥Ã¥ÈÎó¤òÀßÄꤹ¤ë¡£
626 .\"O Bits used by these four ioctls:
627 ¤³¤ì¤é¤Î 4 ¤Ä¤Î ioctl ¤Ç»È¤ï¤ì¤ë¥Ó¥Ã¥È¤Ï°Ê²¼¤ÎÄ̤ê:
630 TIOCM_LE DSR (data set ready/line enable)
631 TIOCM_DTR DTR (data terminal ready)
632 TIOCM_RTS RTS (request to send)
633 TIOCM_ST Secondary TXD (transmit)
634 TIOCM_SR Secondary RXD (receive)
635 TIOCM_CTS CTS (clear to send)
636 TIOCM_CAR DCD (data carrier detect)
637 .\"O TIOCM_CD see TIOCM_CAR
638 TIOCM_CD TIOCM_CAR ¤ò»²¾È¡£
640 .\"O TIOCM_RI see TIOCM_RNG
641 TIOCM_RI TIOCM_RNG ¤ò»²¾È¡£
642 TIOCM_DSR DSR (data set ready)
644 .\"O .SS "Marking a line as local"
645 .SS "²óÀþ¤ò¥í¡¼¥«¥ë¤È¤·¤Æ¥Þ¡¼¥¯¤¹¤ë"
647 .BI "TIOCGSOFTCAR int *" argp
648 .\"O ("Get software carrier flag")
649 .\"O Get the status of the CLOCAL flag in the c_cflag field of the
652 ("¥½¥Õ¥È¥¦¥§¥¢¥¥ã¥ê¥¢¥Õ¥é¥°¤Î¼èÆÀ")
654 ¹½Â¤ÂΤΠc_cflag ¥Õ¥£¡¼¥ë¥É¤Î
656 ¥Õ¥é¥°¤Î¾õÂÖ¤ò¼èÆÀ¤¹¤ë¡£
658 .BI "TIOCSSOFTCAR const int *" argp
659 .\"O ("Set software carrier flag")
660 .\"O Set the CLOCAL flag in the
664 .\"O is nonzero, and clear it otherwise.
665 ("¥½¥Õ¥È¥¦¥§¥¢¥¥ã¥ê¥¢¥Õ¥é¥°¤ÎÀßÄê")
672 0 ¤Î¾ì¹ç¤Ï¥¯¥ê¥¢¤¹¤ë¡£
676 .\"O flag for a line is off, the hardware carrier detect (DCD)
677 .\"O signal is significant, and an
679 .\"O of the corresponding terminal will block until DCD is asserted,
686 ¥Ï¡¼¥É¥¦¥§¥¢¥¥ã¥ê¥¢¸¡½Ð (hardware carrier detect, DCD) ¥·¥°¥Ê¥ë¤¬½ÅÍפǤ¢¤ê¡¢
688 ¥Õ¥é¥°¤¬»ØÄꤵ¤ì¤Ê¤¤¸Â¤ê¡¢Âбþ¤¹¤ëüËö¤Î
690 ¤Ï DCD ¤¬¼¨¤µ¤ì¤ë¤Þ¤Ç¥Ö¥í¥Ã¥¯¤µ¤ì¤ë¡£
693 .\"O is set, the line behaves as if DCD is always asserted.
695 ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢
696 ¥é¥¤¥ó¤Ï¾ï¤Ë DCD ¤¬¼¨¤µ¤ì¤Æ¤¤¤ë¤«¤Î¤è¤¦¤ËÆ°ºî¤¹¤ë¡£
697 .\"O The software carrier flag is usually turned on for local devices,
698 .\"O and is off for lines with modems.
699 ¥½¥Õ¥È¥¦¥§¥¢¥¥ã¥ê¥¢¥Õ¥é¥°¤Ï¡¢¥í¡¼¥«¥ë¥Ç¥Ð¥¤¥¹¤Ç¤ÏÄ̾ï¤Ï¥ª¥ó¤Ë¤Ê¤Ã¤Æ¤ª¤ê¡¢
700 ¥â¥Ç¥à¤Î¥é¥¤¥ó¤Ç¤Ï¥ª¥Õ¤Ë¤Ê¤Ã¤Æ¤¤¤ë¡£
701 .\"O .SS "Linux-specific"
702 .SS "Linux ¸ÇͤΠioctl"
706 .\"O .BR console_ioctl (4).
709 .BR console_ioctl (4)
711 .\"O .SS "Kernel debugging"
712 .SS ¥«¡¼¥Í¥ë¥Ç¥Ð¥Ã¥®¥ó¥°
713 .B "#include <linux/tty.h>"
715 .BI "TIOCTTYGSTRUCT struct tty_struct *" argp
718 .\"O corresponding to
724 .\"O .\" .SS "Serial info"
725 .\" .SS "¥·¥ê¥¢¥ë¾ðÊó"
726 .\" .BR "#include <linux/serial.h>"
729 .\" .BI "TIOCGSERIAL struct serial_struct *" argp
730 .\"O .\" Get serial info.
731 .\" ¥·¥ê¥¢¥ë¾ðÊó¤ò¼èÆÀ¤¹¤ë¡£
733 .\" .BI "TIOCSSERIAL const struct serial_struct *" argp
734 .\"O .\" Set serial info.
735 .\" ¥·¥ê¥¢¥ë¾ðÊó¤òÀßÄꤹ¤ë¡£
736 .\"O .SH "RETURN VALUE"
740 .\"O system call returns 0 on success.
741 .\"O On error it returns \-1 and sets
745 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¡¢À®¸ù¤·¤¿¾ì¹ç¤Ï 0 ¤òÊÖ¤¹¡£
746 ¥¨¥é¡¼¤Î¾ì¹ç¤Ï \-1 ¤òÊÖ¤·¡¢
753 .\"O Invalid command parameter.
754 ÉÔÀµ¤Ê¥³¥Þ¥ó¥É°ú¤¿ô¤Ç¤¢¤ë¡£
757 .\"O Unknown command.
758 ÉÔÌÀ¤Ê¥³¥Þ¥ó¥É¤Ç¤¢¤ë¡£
767 .\"O Insufficient permission.
771 .\"O Check the condition of DTR on the serial port.
772 ¥·¥ê¥¢¥ë¥Ý¡¼¥È¤Î DTR ¤Î¾õÂÖ¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡£
777 #include <sys/ioctl.h>
784 fd = open("/dev/ttyS0", O_RDONLY);
785 ioctl(fd, TIOCMGET, &serial);
786 if (serial & TIOCM_DTR)
787 .\"O puts("TIOCM_DTR is not set");
788 puts("TIOCM_DTR ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¡£");
790 .\"O puts("TIOCM_DTR is set");
791 puts("TIOCM_DTR ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¡£");
799 .BR console_ioctl (4),
802 .\" FIONBIO const int *
805 .\" FIOASYNC const int *
806 .\"O .\" from serial.c:
808 .\" TIOCSERCONFIG void
809 .\" TIOCSERGWILD int *
810 .\" TIOCSERSWILD const int *
811 .\" TIOCSERGSTRUCT struct async_struct *
812 .\" TIOCSERGETLSR int *
813 .\" TIOCSERGETMULTI struct serial_multiport_struct *
814 .\" TIOCSERSETMULTI const struct serial_multiport_struct *
815 .\"O .\" TIOCGSERIAL, TIOCSSERIAL (see above)
816 .\" TIOCGSERIAL, TIOCSSERIAL (¾åµ¤ò»²¾È)