OSDN Git Service

(split) LDP v3.24 -> v3.29 の定型的な変更内容を反映。
[linuxjm/LDP_man-pages.git] / draft / man4 / tty_ioctl.4
1 .\" Copyright 2002 Walter Harms <walter.harms@informatik.uni-oldenburg.de>
2 .\" and Andries Brouwer <aeb@cwi.nl>.
3 .\" Distributed under GPL.
4 .\"
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>
9 .\"
10 .TH TTY_IOCTL 4 2008-10-29 "Linux" "Linux Programmer's Manual"
11 .\"O .SH NAME
12 .SH Ì¾Á°
13 .\"O tty_ioctl \- ioctls for terminals and serial lines
14 tty_ioctl \- Ã¼Ëö¤È¥·¥ê¥¢¥ë¥é¥¤¥ó¤Î ioctl (Æþ½ÐÎÏÀ©¸æ)
15 .\"O .SH SYNOPSIS
16 .SH ½ñ¼°
17 .B "#include <termios.h>"
18 .sp
19 .BI "int ioctl(int " fd ", int " cmd ", ...);"
20 .\"O .SH DESCRIPTION
21 .SH ÀâÌÀ
22 .\"O The
23 .\"O .BR ioctl ()
24 .\"O call for terminals and serial ports accepts many possible command arguments.
25 üËö¤È¥·¥ê¥¢¥ë¥Ý¡¼¥È¤Ë¤Ä¤¤¤Æ¤Î
26 .BR ioctl ()
27 ¥³¡¼¥ë¤Ï¡¢Â¿¤¯¤Î¥³¥Þ¥ó¥É°ú¤­¿ô¤ò¼õ¤±ÉÕ¤±¤ë¡£
28 .\"O Most require a third argument, of varying type, here called \fIargp\fP
29 .\"O or \fIarg\fP.
30 ¿¤¯¤¬¤¤¤í¤¤¤í¤Ê·¿¤Î 3 ÈÖÌܤΰú¤­¿ô¤òɬÍפȤ¹¤ë¡£
31 ¤³¤³¤Ç¤Ï \fIargp\fP ¤Þ¤¿¤Ï \fIarg\fP ¤È¸Æ¤Ö¡£
32 .LP
33 .\"O Use of
34 .\"O .I ioctl
35 .\"O makes for nonportable programs.
36 .\"O Use the POSIX interface described in
37 .\"O .BR termios (3)
38 .\"O whenever possible.
39 .I ioctl
40 ¤ò»ÈÍѤ¹¤ë¤È°Ü¿¢À­¤Î¤Ê¤¤¥×¥í¥°¥é¥à¤Ë¤Ê¤ë¡£
41 ²Äǽ¤Ê¾ì¹ç¤Ï¡¢
42 .BR termios (3)
43 ¤Ëµ­½Ò¤µ¤ì¤Æ¤¤¤ë POSIX ¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤ò»È¤¦¤³¤È¡£
44 .\"O .SS "Get and Set Terminal Attributes"
45 .SS Ã¼Ëö°À­¤Î¼èÆÀ¤ÈÀßÄê
46 .TP
47 .BI "TCGETS     struct termios *" argp
48 .\"O Equivalent to
49 .\"O .IR "tcgetattr(fd, argp)" .
50 .I "tcgetattr(fd, argp)"
51 ¤ÈƱ¤¸¡£
52 .br
53 .\"O Get the current serial port settings.
54 ¸½ºß¤Î¥·¥ê¥¢¥ë¥Ý¡¼¥È¤ÎÀßÄê¤ò¼èÆÀ¤¹¤ë¡£
55 .TP
56 .BI "TCSETS     const struct termios *" argp
57 .\"O Equivalent to
58 .\"O .IR "tcsetattr(fd, TCSANOW, argp)" .
59 .I "tcsetattr(fd, TCSANOW, argp)"
60 ¤ÈƱ¤¸¡£
61 .br
62 .\"O Set the current serial port settings.
63 ¸½ºß¤Î¥·¥ê¥¢¥ë¥Ý¡¼¥È¤ÎÀßÄê¤òÊѹ¹¤¹¤ë¡£
64 .TP
65 .BI "TCSETSW    const struct termios *" argp
66 .\"O Equivalent to
67 .\"O .IR "tcsetattr(fd, TCSADRAIN, argp)" .
68 .I "tcsetattr(fd, TCSADRAIN, argp)"
69 ¤ÈƱ¤¸¡£
70 .br
71 .\"O Allow the output buffer to drain, and
72 .\"O set the current serial port settings.
73 ÇӽР(drain) ¤ò¹Ô¤¦¤¿¤á¤Î½ÐÎϥХåե¡¤Î»ÈÍѤòµö²Ä¤·¡¢
74 ¸½ºß¤Î¥·¥ê¥¢¥ë¥Ý¡¼¥È¤ÎÀßÄê¤òÊѹ¹¤¹¤ë¡£
75 .TP
76 .BI "TCSETSF    const struct termios *" argp
77 .\"O Equivalent to
78 .\"O .IR "tcsetattr(fd, TCSAFLUSH, argp)" .
79 .I "tcsetattr(fd, TCSAFLUSH, argp)"
80 ¤ÈƱ¤¸¡£
81 .br
82 .\"O Allow the output buffer to drain, discard pending input, and
83 .\"O set the current serial port settings.
84 ÇӽР(drain) ¤ò¹Ô¤¦¤¿¤á¤Î½ÐÎϥХåե¡¤Î»ÈÍѤòµö²Ä¤·¡¢
85 ½èÍý¤·¤Æ¤¤¤Ê¤¤ÆþÎϤòÇË´þ¤·¤Æ¡¢
86 ¸½ºß¤Î¥·¥ê¥¢¥ë¥Ý¡¼¥È¤ÎÀßÄê¤òÊѹ¹¤¹¤ë¡£
87 .LP
88 .\"O The following four ioctls are just like
89 .\"O .BR TCGETS ,
90 .\"O .BR TCSETS ,
91 .\"O .BR TCSETSW ,
92 .\"O .BR TCSETSF ,
93 .\"O except that they take a
94 .\"O .I "struct termio *"
95 .\"O instead of a
96 .\"O .IR "struct termios *" .
97 °Ê²¼¤Î 4 ¤Ä¤Î ioctl ¤Ï
98 .BR TCGETS ,
99 .BR TCSETS ,
100 .BR TCSETSW ,
101 .B TCSETSF
102 ¤È»÷¤Æ¤¤¤ë¡£
103 ¤¿¤À¤·¡¢
104 .I "struct termios *"
105 ¤ÎÂå¤ï¤ê¤Ë
106 .I "struct termio *"
107 ¤ò¼è¤ë¡£
108 .TP
109 .BI "TCGETA     struct termio *" argp
110 .TP
111 .BI "TCSETA     const struct termio *" argp
112 .TP
113 .BI "TCSETAW    const struct termio *" argp
114 .TP
115 .BI "TCSETAF    const struct termio *" argp
116 .\"O .SS "Locking the termios structure"
117 .SS "termios ¹½Â¤ÂΤΥí¥Ã¥¯"
118 .\"O The
119 .\"O .I termios
120 .\"O structure of a terminal can be locked.
121 .\"O The lock is itself a
122 .\"O .I termios
123 .\"O structure, with nonzero bits or fields indicating a
124 .\"O locked value.
125 üËö¤Î
126 .I termios
127 ¹½Â¤ÂΤϥí¥Ã¥¯¤¹¤ë¤³¤È¤¬²Äǽ¤Ç¤¢¤ë¡£
128 ¤³¤Î¥í¥Ã¥¯¼«ÂΤÏ
129 .I termios
130 ¹½Â¤ÂΤǤ¢¤ê¡¢
131 0 ¤Ç¤Ê¤¤¥Ó¥Ã¥È¤Þ¤¿¤Ï¥Õ¥£¡¼¥ë¥É¤Ï¥í¥Ã¥¯¤µ¤ì¤¿Ãͤò¼¨¤¹¡£
132 .TP
133 .BI "TIOCGLCKTRMIOS     struct termios *" argp
134 .\"O Gets the locking status of the
135 .\"O .I termios
136 .\"O structure of the terminal.
137 üËö¤Î
138 .I termios
139 ¹½Â¤ÂΤΥí¥Ã¥¯¾õÂÖ¤ò¼èÆÀ¤¹¤ë¡£
140 .TP
141 .BI "TIOCSLCKTRMIOS     const struct termios *" argp
142 .\"O Sets the locking status of the
143 .\"O .I termios
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.
148 üËö¤Î
149 .I termios
150 ¹½Â¤ÂΤΥí¥Ã¥¯¾õÂÖ¤òÀßÄꤹ¤ë¡£
151 root ¤Î¤ß (¤è¤êÀµ³Î¤Ë¤Ï¡¢
152 .B CAP_SYS_ADMIN
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 ²¾ÁÛüËö¤Î¥µ¥¤¥º¤¬Êѹ¹¤µ¤ì¤¿¾ì¹ç¡¢¥«¡¼¥Í¥ë¤Ï¥¦¥£¥ó¥É¥¦¥µ¥¤¥º¤ò¹¹¿·¤¹¤ë)¡£
164
165 .\"O The following constants and structure are defined in
166 .\"O .IR <sys/ioctl.h> .
167 °Ê²¼¤ÎÄê¿ô¤È¹½Â¤ÂΤÏ
168 .I <sys/ioctl.h>
169 ¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£
170 .TP
171 .BI "TIOCGWINSZ struct winsize *" argp
172 .\"O Get window size.
173 ¥¦¥£¥ó¥É¥¦¥µ¥¤¥º¤ò¼èÆÀ¤¹¤ë¡£
174 .TP
175 .BI "TIOCSWINSZ const struct winsize *" argp
176 .\"O Set window size.
177 ¥¦¥£¥ó¥É¥¦¥µ¥¤¥º¤òÀßÄꤹ¤ë¡£
178 .LP
179 .\"O The struct used by these ioctls is defined as
180 ¤³¤ì¤é¤Î ioctl ¤Ç»ÈÍѤµ¤ì¤ë¹½Â¤ÂΤϡ¢°Ê²¼¤Î¤è¤¦¤ËÄêµÁ¤µ¤ì¤ë¡£
181
182 .in +4n
183 .nf
184 struct winsize {
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;   /* Ì¤»ÈÍÑ */
191 };
192 .fi
193 .in
194
195 .\"O When the window size changes, a
196 .\"O .B SIGWINCH
197 .\"O signal is sent to the
198 .\"O foreground process group.
199 ¥¦¥£¥ó¥É¥¦¥µ¥¤¥º¤¬Êѹ¹¤µ¤ì¤¿¾ì¹ç¡¢
200 ¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Ë
201 .B SIGWINCH
202 ¥·¥°¥Ê¥ë¤¬Á÷¤é¤ì¤ë¡£
203 .\"O .SS "Sending a Break"
204 .SS "break ¤ÎÁ÷¿®"
205 .TP
206 .BI "TCSBRK     int " arg
207 .\"O Equivalent to
208 .\"O .IR "tcsendbreak(fd, arg)" .
209 .I "tcsendbreak(fd, arg)"
210 ¤ÈƱ¤¸¡£
211 .br
212 .\"O If the terminal is using asynchronous serial data transmission, and
213 .\"O .I arg
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 üËö¤¬ÈóƱ´ü¥·¥ê¥¢¥ë¥Ç¡¼¥¿Å¾Á÷¤ò»ÈÍѤ·¤Æ¤ª¤ê¡¢
220 .I arg
221 ¤¬ 0 ¤Î¾ì¹ç¡¢0.25 ¤«¤é 0.5 Éäδ֤Ë
222 break (0 ¤Î¥Ó¥Ã¥ÈÎó¤Î¥¹¥È¥ê¡¼¥à) ¤¬Á÷¿®¤µ¤ì¤ë¡£
223 üËö¤¬ÈóƱ´ü¥·¥ê¥¢¥ë¥Ç¡¼¥¿Å¾Á÷¤ò»ÈÍѤ·¤Æ¤¤¤ë¾ì¹ç¡¢
224 break ¤¬Á÷¿®¤µ¤ì¤ë¤«¡¢¤³¤Î´Ø¿ô¤Ï²¿¤â¤»¤º¤ËÊ֤롣
225 .\"O When
226 .\"O .I arg
227 .\"O is nonzero, nobody knows what will happen.
228 .I arg
229 ¤¬ 0 °Ê³°¤Î¾ì¹ç¡¢²¿¤¬µ¯¤³¤ë¤«Ê¬¤«¤é¤Ê¤¤¡£
230
231 .\"O (SVr4, UnixWare, Solaris, Linux treat
232 .\"O .I "tcsendbreak(fd,arg)"
233 .\"O with nonzero
234 .\"O .I arg
235 .\"O like
236 .\"O .IR "tcdrain(fd)" .
237 (SVr4, UnixWare, Solaris, Linux ¤Ï¡¢
238 .I "tcsendbreak(fd,arg)"
239 ¤Î
240 .I arg
241 ¤¬ 0 °Ê³°¤Î¾ì¹ç¡¢
242 .I "tcdrain(fd)"
243 ¤Î¤è¤¦¤Ë°·¤¦¡£
244 .\"O SunOS treats
245 .\"O .I arg
246 .\"O as a multiplier, and sends a stream of bits
247 .\"O .I arg
248 .\"O times as long as done for zero
249 .\"O .IR arg .
250 SunOS ¤Ï
251 .I arg
252 ¤òÇÜ¿ô¤È¤·¤Æ°·¤¤¡¢¥Ó¥Ã¥È¤Î¥¹¥È¥ê¡¼¥à¤ò
253 .I arg
254 ²óÁ÷¿®¤¹¤ë¡£
255 .I arg
256 ¤¬ 0 ¤Î¾ì¹ç¤âƱ¤¸¡£
257 .\"O DG/UX and AIX treat
258 .\"O .I arg
259 .\"O (when nonzero) as a time interval measured in milliseconds.
260 DG/UX ¤È AIX ¤Ï¡¢(0 °Ê³°¤Î¾ì¹ç)
261 .I arg
262 ¤ò¥ß¥êÉÃñ°Ì¤Î»þ´Ö´Ö³Ö¤È¤·¤Æ°·¤¦¡£
263 .\"O HP-UX ignores
264 .\"O .IR arg .)
265 HP-UX ¤Ï
266 .I arg
267 ¤ò̵»ë¤¹¤ë¡£)
268 .TP
269 .BI "TCSBRKP    int " arg
270 .\"O So-called "POSIX version" of
271 .\"O .BR TCSBRK .
272 .\"O It treats nonzero
273 .\"O .I arg
274 .\"O as a timeinterval measured in deciseconds, and does nothing
275 .\"O when the driver does not support breaks.
276 ¤¤¤ï¤æ¤ë¡ÖPOSIX ÈǡפÎ
277 .B TCSBRK
278 ¤Ç¤¢¤ë¡£
279 ¤³¤ì¤Ï 0 °Ê³°¤Î
280 .I arg
281 ¤ò 1/10 ÉÃñ°Ì¤Î»þ´Ö´Ö³Ö¤È¤·¤Æ°·¤¦¡£
282 ¤Þ¤¿¥É¥é¥¤¥Ð¤¬ break ¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¡¢²¿¤â¤·¤Ê¤¤¡£
283 .TP
284 .B "TIOCSBRK    void"
285 .\"O Turn break on, that is, start sending zero bits.
286 break ¤ò¥ª¥ó¤Ë¤¹¤ë¡£
287 ¤Ä¤Þ¤ê 0 ¤Î¥Ó¥Ã¥ÈÎó¤ÎÁ÷¿®¤ò³«»Ï¤¹¤ë¡£
288 .TP
289 .B "TIOCCBRK    void"
290 .\"O Turn break off, that is, stop sending zero bits.
291 break ¤ò¥ª¥Õ¤Ë¤¹¤ë¡£
292 ¤Ä¤Þ¤ê 0 ¤Î¥Ó¥Ã¥ÈÎó¤ÎÁ÷¿®¤òÄä»ß¤¹¤ë¡£
293 .\"O .SS "Software flow control"
294 .SS ¥½¥Õ¥È¥¦¥§¥¢¥Õ¥í¡¼À©¸æ
295 .TP
296 .BI "TCXONC     int " arg
297 .\"O Equivalent to
298 .\"O .IR "tcflow(fd, arg)" .
299 .I "tcflow(fd, arg)"
300 ¤ÈƱ¤¸¡£
301 .br
302 .\"O See
303 .\"O .BR tcflow (3)
304 .\"O for the argument values
305 .\"O .BR TCOOFF ,
306 .\"O .BR TCOON ,
307 .\"O .BR TCIOFF ,
308 .\"O .BR TCION .
309 .BR tcflow (3)
310 ¤Î°ú¤­¿ô
311 .BR TCOOFF ,
312 .BR TCOON ,
313 .BR TCIOFF ,
314 .B TCION
315 ¤ò»²¾È¤¹¤ë¤³¤È¡£
316 .\"O .SS "Buffer count and flushing"
317 .SS "¥Ð¥Ã¥Õ¥¡¤Î¥«¥¦¥ó¥È¤È½ñ¤­½Ð¤· (flush)"
318 .TP
319 .BI "FIONREAD   int *" argp
320 .\"O Get the number of bytes in the input buffer.
321 ÆþÎϥХåե¡¤Ë¤¢¤ë¥Ð¥¤¥È¿ô¤ò¼èÆÀ¤¹¤ë¡£
322 .TP
323 .BI "TIOCINQ    int *" argp
324 .\"O Same as
325 .\"O .BR FIONREAD .
326 .B FIONREAD
327 ¤ÈƱ¤¸¡£
328 .TP
329 .BI "TIOCOUTQ   int *" argp
330 .\"O Get the number of bytes in the output buffer.
331 ½ÐÎϥХåե¡¤Ë¤¢¤ë¥Ð¥¤¥È¿ô¤ò¼èÆÀ¤¹¤ë¡£
332 .TP
333 .BI "TCFLSH     int " arg
334 .\"O Equivalent to
335 .\"O .IR "tcflush(fd, arg)" .
336 .I "tcflush(fd, arg)"
337 ¤ÈƱ¤¸¡£
338 .br
339 .\"O See
340 .\"O .BR tcflush (3)
341 .\"O for the argument values
342 .\"O .BR TCIFLUSH ,
343 .\"O .BR TCOFLUSH ,
344 .\"O .BR TCIOFLUSH .
345 .BR tcflush (3)
346 ¤Î°ú¤­¿ô
347 .BR TCIFLUSH ,
348 .BR TCOFLUSH ,
349 .B TCIOFLUSH
350 ¤ò»²¾È¤¹¤ë¤³¤È¡£
351 .\"O .SS "Faking input"
352 .SS ÆþÎϤε¶Áõ
353 .TP
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 ¥³¥ó¥½¡¼¥ë½ÐÎϤΥê¥À¥¤¥ì¥¯¥È
359 .TP
360 .B "TIOCCONS    void"
361 .\"O Redirect output that would have gone to
362 .\"O .I /dev/console
363 .\"O or
364 .\"O .I /dev/tty0
365 .\"O to the given terminal.
366 .\"O If that was a pseudoterminal master, send it to the slave.
367 .I /dev/console
368 ¤Þ¤¿¤Ï
369 .I /dev/tty0
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
381 .RB ( CAP_SYS_ADMIN
382 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò»ý¤Ä¥×¥í¥»¥¹) ¤À¤±¤¬¥ê¥À¥¤¥ì¥¯¥È¤ò¹Ô¤¦¤³¤È¤¬¤Ç¤­¤ë¡£
383 .\"O If output was redirected already
384 .\"O .B EBUSY
385 .\"O is returned,
386 .\"O but redirection can be stopped by using this ioctl with
387 .\"O .I fd
388 .\"O pointing at
389 .\"O .I /dev/console
390 .\"O or
391 .\"O .IR /dev/tty0 .
392 ½ÐÎϤ¬¤¹¤Ç¤Ë¥ê¥À¥¤¥ì¥¯¥È¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï
393 .B EBUSY
394 ¤¬ÊÖ¤µ¤ì¤ë¤¬¡¢
395 .I /dev/console
396 ¤«
397 .I /dev/tty0
398 ¤ò»Ø¤·¤Æ¤¤¤ë
399 .I fd
400 ¤ËÂФ·¤Æ¤³¤Î ioctl ¤ò»ÈÍѤ¹¤ë¤³¤È¤Ç¡¢¥ê¥À¥¤¥ì¥¯¥È¤ò»ß¤á¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
401 .\"O .SS "Controlling terminal"
402 .SS "üËö¤ÎÀ©¸æ"
403 .TP
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
411 .\"O .BR EPERM ,
412 .\"O unless the caller is root (more precisely: has the
413 .\"O .BR CAP_SYS_ADMIN
414 .\"O capability) and
415 .\"O .I arg
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 ¤³¤ÎüËö¤¬´û¤Ë¾¤Î¥»¥Ã¥·¥ç¥ó¥°¥ë¡¼¥×¤ÎÀ©¸æüËö¤Ç¤¢¤ë¾ì¹ç¡¢
421 ioctl ¤Ï
422 .B EPERM
423 ¤Ç¼ºÇÔ¤¹¤ë¡£¤¿¤À¤·¸Æ¤Ó½Ð¤·¤¿¥æ¡¼¥¶¤¬ root ¤Ç
424 (¤è¤êÀµ³Î¤Ë¤Ï
425 .B CAP_SYS_ADMIN
426 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò»ý¤Ã¤Æ¤¤¤Æ)¡¢¤«¤Ä
427 .I arg
428 ¤¬ 1 ¤Ç¤¢¤ë¾ì¹ç¤ò½ü¤¯¡£
429 ¤³¤Î¾ì¹ç¡¢Ã¼Ëö¤ÏÅð¤Þ¤ì (stolen)¡¢
430 ¤³¤ÎüËö¤òÀ©¸æüËö¤È¤·¤Æ¤¤¤¿Á´¤Æ¤Î¥×¥í¥»¥¹¤ÏüËö¤ò¼º¤¦¡£
431 .TP
432 .B TIOCNOTTY    void
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,
436 .\"O then send
437 .\"O .B SIGHUP
438 .\"O and
439 .\"O .B SIGCONT
440 .\"O to the foreground process group
441 .\"O and all processes in the current session lose their controlling terminal.
442 »ØÄꤵ¤ì¤¿Ã¼Ëö¤¬¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥»¥¹¤ÎÀ©¸æüËö¤Ç¤¢¤ë¾ì¹ç¡¢
443 ¤³¤ÎÀ©¸æüËö¤òÊü´þ¤¹¤ë¡£
444 ¥×¥í¥»¥¹¤¬¥»¥Ã¥·¥ç¥ó¥ê¡¼¥À¤Î¾ì¹ç¡¢
445 ¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Ë
446 .B SIGHUP
447 ¤È
448 .B SIGCONT
449 ¤òÁ÷¤ê¡¢¥«¥ì¥ó¥È¥»¥Ã¥·¥ç¥ó¤ÎÁ´¤Æ¤Î¥×¥í¥»¥¹¤ÏÀ©¸æüËö¤ò¼º¤¦¡£
450 .\"O .SS "Process group and session ID"
451 .SS "¥°¥ë¡¼¥× ID ¤È¥»¥Ã¥·¥ç¥ó ID ¤Î½èÍý"
452 .TP
453 .BI "TIOCGPGRP  pid_t *" argp
454 .\"O When successful, equivalent to
455 .\"O .IR "*argp = tcgetpgrp(fd)" .
456 À®¸ù¤·¤¿¾ì¹ç¡¢
457 .I "*argp = tcgetpgrp(fd)"
458 ¤ÈƱ¤¸¡£
459 .br
460 .\"O Get the process group ID of the foreground process group on this terminal.
461 ¤³¤ÎüËö¾å¤Î¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¥×¥í¥»¥¹¤Î¥×¥í¥»¥¹¥°¥ë¡¼¥× ID ¤ò¼èÆÀ¤¹¤ë¡£
462 .TP
463 .BI "TIOCSPGRP  const pid_t *" argp
464 .\"O Equivalent to
465 .\"O .IR "tcsetpgrp(fd, *argp)" .
466 .I "tcsetpgrp(fd, *argp)"
467 ¤ÈƱ¤¸¡£
468 .br
469 .\"O Set the foreground process group ID of this terminal.
470 ¤³¤ÎüËö¤Î¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¥×¥í¥»¥¹¤Î¥°¥ë¡¼¥× ID ¤òÀßÄꤹ¤ë¡£
471 .TP
472 .BI "TIOCGSID   pid_t *" argp
473 .\"O Get the session ID of the given terminal.
474 .\"O This will fail with
475 .\"O .B ENOTTY
476 .\"O in case the terminal is not a master pseudoterminal
477 .\"O and not our controlling terminal.
478 .\"O Strange.
479 »ØÄꤵ¤ì¤¿Ã¼Ëö¤Î¥»¥Ã¥·¥ç¥ó ID ¤ò¼èÆÀ¤¹¤ë¡£
480 üËö¤¬¥Þ¥¹¥¿µ¿»÷üËö¤Þ¤¿¤ÏÀ©¸æüËö¤Ç¤Ê¤¤¾ì¹ç¤Ï¡¢
481 .B ENOTTY
482 ¤Ç¼ºÇÔ¤¹¤ë¡£
483 ´ñ̯¤À¡£
484 .\"O .SS "Exclusive mode"
485 .SS ÇÓ¾¥â¡¼¥É
486 .TP
487 .B "TIOCEXCL    void"
488 .\"O Put the terminal into exclusive mode.
489 .\"O No further
490 .\"O .BR open (2)
491 .\"O operations on the terminal are permitted.
492 .\"O (They will fail with
493 .\"O .BR EBUSY ,
494 .\"O except for root, that is, a process with the
495 .\"O .BR CAP_SYS_ADMIN
496 .\"O capability.)
497 üËö¤òÇÓ¾¥â¡¼¥É¤Ë¤¹¤ë¡£
498 üËö¤ËÂФ·¤Æ¡¢¤³¤ì°Ê¹ß¤Î
499 .BR open (2)
500 Áàºî¤ò¶Ø»ß¤¹¤ë¡£
501 (root °Ê³°¤Î¾ì¹ç¡¢¤Ä¤Þ¤ê
502 .B CAP_SYS_ADMIN
503 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò»ý¤¿¤Ê¤¤¥×¥í¥»¥¹¤Î¾ì¹ç¡¢¤³¤ì°Ê¹ß¤Î
504 .BR open (2)
505 ¤Ï
506 .B EBUSY
507 ¤Ç¼ºÇÔ¤¹¤ë¡£)
508 .TP
509 .B "TIOCNXCL    void"
510 .\"O Disable exclusive mode.
511 ÇÓ¾¥â¡¼¥É¤ò̵¸ú¤Ë¤¹¤ë¡£
512 .\"O .SS "Line discipline"
513 .SS "¥é¥¤¥óÀ©¸æ (line discipline)"
514 .TP
515 .BI "TIOCGETD   int *" argp
516 .\"O Get the line discipline of the terminal.
517 üËö¤Î¥é¥¤¥óÀ©¸æ¤Î¾ðÊó¤ò¼èÆÀ¤¹¤ë¡£
518 .TP
519 .BI "TIOCSETD   const int *" argp
520 .\"O Set the line discipline of the terminal.
521 üËö¤Î¥é¥¤¥óÀ©¸æ¤Î¾ðÊó¤òÀßÄꤹ¤ë¡£
522 .\"O .SS "Pseudoterminal ioctls"
523 .SS "µ¿»÷üËö¤Î ioctl"
524 .TP
525 .BI "TIOCPKT    const int *" argp
526 .\"O Enable (when
527 .\"O .RI * argp
528 .\"O is nonzero) or disable packet mode.
529 ¥Ñ¥±¥Ã¥È¥â¡¼¥É¤òÍ­¸ú
530 .RI (* argp
531 ¤¬ 0 °Ê³°¤Î¾ì¹ç) ¤Þ¤¿¤Ï̵¸ú¤Ë¤¹¤ë¡£
532 .\"O Can be applied to the master side of a pseudoterminal only (and will return
533 .\"O .B ENOTTY
534 .\"O otherwise).
535 .\"O In packet mode, each subsequent
536 .\"O .BR read (2)
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
541 .\"O .B TIOCPKT_DATA
542 .\"O (0), it is an OR of one
543 .\"O or more of the following bits:
544 µ¿»÷üËö¤Î¥Þ¥¹¥¿Â¦¤Ë¤Î¤ßŬÍѤǤ­¤ë (¤½¤ì°Ê³°¤Î¾ì¹ç¤Ï
545 .B ENOTTY
546 ¤òÊÖ¤¹)¡£
547 ¥Ñ¥±¥Ã¥È¥â¡¼¥É¤Ç¤Ï¡¢¤½¤Î¸å¤Ë¼Â¹Ô¤µ¤ì¤ë
548 .BR read (2)
549 ¤Ï¡¢Ãͤ¬ 0 °Ê³°¤Î 1 ¤Ä¤ÎÀ©¸æ¥Ð¥¤¥È¤ò´Þ¤à¥Ñ¥±¥Ã¥È¤«¡¢
550 Ãͤ¬ 0 ¤Î 1 ¥Ð¥¤¥È (\(aq\\0\(aq) ¤Ëµ¿»÷üËö¤Î¥¹¥ì¡¼¥Ö¦¤Ç½ñ¤­¹þ¤Þ¤ì¤¿
551 ¥Ç¡¼¥¿¤¬Â³¤¯¥Ñ¥±¥Ã¥È¤òÊÖ¤¹¡£
552 ºÇ½é¤Î¥Ð¥¤¥È¤¬
553 .B TIOCPKT_DATA
554 (0) ¤Ç¤Ê¤¤¾ì¹ç¡¢°Ê²¼¤Î¥Ó¥Ã¥È¤Î 1 ¤Ä°Ê¾å¤ò OR ¤·¤¿¤â¤Î¤Ç¤¢¤ë:
555
556 .nf
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 ¤Ç¤Ê¤¤¡£
569 .fi
570
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
574 .\"O .BR select (2)
575 .\"O for exceptional conditions.
576 ¤³¤Î¥â¡¼¥É¤¬»È¤ï¤ì¤Æ¤¤¤ë¾ì¹ç¡¢
577 À©¸æ¾õÂÖ¾ðÊó¤Î¸ºß¤¬¥Þ¥¹¥¿Â¦¤«¤éÆɤ߹þ¤á¤ë¤«¤Ï¡¢
578 Î㳰Ū¤Ê¾ò·ï¤Ç
579 .BR select (2)
580 ¤ò»È¤¦¤³¤È¤Ë¤è¤êÃΤ뤳¤È¤¬¤Ç¤­¤ë¡£
581
582 .\"O This mode is used by
583 .\"O .BR rlogin (1)
584 .\"O and
585 .\"O .BR rlogind (8)
586 .\"O to implement a remote-echoed,
587 .\"O locally \fB^S\fP/\fB^Q\fP flow-controlled remote login.
588 ¤³¤Î¥â¡¼¥É¤Ï
589 .BR rlogin (1)
590 ¤È
591 .BR rlogind (8)
592 ¤Ç»È¤ï¤ì¡¢¥ê¥â¡¼¥È¥¨¥³¡¼¤Î¥ê¥â¡¼¥È¥í¥°¥¤¥ó¤È
593 ¥í¡¼¥«¥ë¤Ç¤Î \fB^S\fP/\fB^Q\fP ¥Õ¥í¡¼À©¸æ¤Î¥ê¥â¡¼¥È¥í¥°¥¤¥ó¤ò¼ÂÁõ¤·¤Æ¤¤¤ë¡£
594
595 .\"O The BSD ioctls
596 .\"O .BR TIOCSTOP ,
597 .\"O .BR TIOCSTART ,
598 .\"O .BR TIOCUCNTL ,
599 .\"O .B TIOCREMOTE
600 .\"O have not been implemented under Linux.
601 BSD ¤Î ioctl ¤Ç¤¢¤ë
602 .BR TIOCSTOP ,
603 .BR TIOCSTART ,
604 .BR TIOCUCNTL ,
605 .B TIOCREMOTE
606 ¤Ï¡¢Linux ¤Ç¤Ï¼ÂÁõ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
607 .\"O .SS "Modem control"
608 .SS ¥â¥Ç¥àÀ©¸æ
609 .TP
610 .BI "TIOCMGET   int *" argp
611 .\"O get the status of modem bits.
612 ¥â¥Ç¥à¥Ó¥Ã¥ÈÎó¤Î¾õÂÖ¤ò¼èÆÀ¤¹¤ë¡£
613 .TP
614 .BI "TIOCMSET   const int *" argp
615 .\"O set the status of modem bits.
616 ¥â¥Ç¥à¥Ó¥Ã¥ÈÎó¤Î¾õÂÖ¤òÀßÄꤹ¤ë¡£
617 .TP
618 .BI "TIOCMBIC   const int *" argp
619 .\"O clear the indicated modem bits.
620 »ØÄꤵ¤ì¤¿¥â¥Ç¥à¥Ó¥Ã¥ÈÎó¤ò¥¯¥ê¥¢¤¹¤ë¡£
621 .TP
622 .BI "TIOCMBIS   const int *" argp
623 .\"O set the indicated modem bits.
624 »ØÄꤵ¤ì¤¿¥â¥Ç¥à¥Ó¥Ã¥ÈÎó¤òÀßÄꤹ¤ë¡£
625 .LP
626 .\"O Bits used by these four ioctls:
627 ¤³¤ì¤é¤Î 4 ¤Ä¤Î ioctl ¤Ç»È¤ï¤ì¤ë¥Ó¥Ã¥È¤Ï°Ê²¼¤ÎÄ̤ê:
628
629 .nf
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 ¤ò»²¾È¡£
639 TIOCM_RNG       RNG (ring)
640 .\"O TIOCM_RI         see TIOCM_RNG
641 TIOCM_RI         TIOCM_RNG ¤ò»²¾È¡£
642 TIOCM_DSR       DSR (data set ready)
643 .fi
644 .\"O .SS "Marking a line as local"
645 .SS "²óÀþ¤ò¥í¡¼¥«¥ë¤È¤·¤Æ¥Þ¡¼¥¯¤¹¤ë"
646 .TP
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
650 .\"O .I termios
651 .\"O structure.
652 ("¥½¥Õ¥È¥¦¥§¥¢¥­¥ã¥ê¥¢¥Õ¥é¥°¤Î¼èÆÀ")
653 .I termios
654 ¹½Â¤ÂΤΠc_cflag ¥Õ¥£¡¼¥ë¥É¤Î
655 .B CLOCAL
656 ¥Õ¥é¥°¤Î¾õÂÖ¤ò¼èÆÀ¤¹¤ë¡£
657 .TP
658 .BI "TIOCSSOFTCAR       const int *" argp
659 .\"O ("Set software carrier flag")
660 .\"O Set the CLOCAL flag in the
661 .\"O .I termios
662 .\"O structure when
663 .\"O .RI * argp
664 .\"O is nonzero, and clear it otherwise.
665 ("¥½¥Õ¥È¥¦¥§¥¢¥­¥ã¥ê¥¢¥Õ¥é¥°¤ÎÀßÄê")
666 .RI * argp
667 ¤¬ 0 °Ê³°¤Î¾ì¹ç¡¢
668 .I termios
669 ¹½Â¤ÂΤÎ
670 .B CLOCAL
671 ¥Õ¥é¥°¤òÀßÄꤹ¤ë¡£
672 0 ¤Î¾ì¹ç¤Ï¥¯¥ê¥¢¤¹¤ë¡£
673 .LP
674 .\"O If the
675 .\"O .B CLOCAL
676 .\"O flag for a line is off, the hardware carrier detect (DCD)
677 .\"O signal is significant, and an
678 .\"O .BR open (2)
679 .\"O of the corresponding terminal will block until DCD is asserted,
680 .\"O unless the
681 .\"O .B O_NONBLOCK
682 .\"O flag is given.
683 ¥é¥¤¥ó¤Î
684 .B CLOCAL
685 ¥Õ¥é¥°¤¬¥ª¥Õ¤Î¾ì¹ç¡¢
686 ¥Ï¡¼¥É¥¦¥§¥¢¥­¥ã¥ê¥¢¸¡½Ð (hardware carrier detect, DCD) ¥·¥°¥Ê¥ë¤¬½ÅÍפǤ¢¤ê¡¢
687 .B O_NONBLOCK
688 ¥Õ¥é¥°¤¬»ØÄꤵ¤ì¤Ê¤¤¸Â¤ê¡¢Âбþ¤¹¤ëüËö¤Î
689 .BR open (2)
690 ¤Ï DCD ¤¬¼¨¤µ¤ì¤ë¤Þ¤Ç¥Ö¥í¥Ã¥¯¤µ¤ì¤ë¡£
691 .\"O If
692 .\"O .B CLOCAL
693 .\"O is set, the line behaves as if DCD is always asserted.
694 .B CLOCAL
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"
703 .\"O For the
704 .\"O .B TIOCLINUX
705 .\"O ioctl, see
706 .\"O .BR console_ioctl (4).
707 .B TIOCLINUX
708 ioctl ¤Ë¤Ä¤¤¤Æ¤Ï¡¢
709 .BR console_ioctl (4)
710 ¤ò»²¾È¤¹¤ë¤³¤È¡£
711 .\"O .SS "Kernel debugging"
712 .SS ¥«¡¼¥Í¥ë¥Ç¥Ð¥Ã¥®¥ó¥°
713 .B "#include <linux/tty.h>"
714 .TP
715 .BI "TIOCTTYGSTRUCT     struct tty_struct *" argp
716 .\"O Get the
717 .\"O .I tty_struct
718 .\"O corresponding to
719 .\"O .IR fd .
720 .I fd
721 ¤ËÂбþ¤¹¤ë
722 .I tty_struct
723 ¤ò¼èÆÀ¤¹¤ë¡£
724 .\"O .\" .SS "Serial info"
725 .\" .SS "¥·¥ê¥¢¥ë¾ðÊó"
726 .\" .BR "#include <linux/serial.h>"
727 .\" .sp
728 .\" .TP
729 .\" .BI "TIOCGSERIAL    struct serial_struct *" argp
730 .\"O .\" Get serial info.
731 .\" ¥·¥ê¥¢¥ë¾ðÊó¤ò¼èÆÀ¤¹¤ë¡£
732 .\" .TP
733 .\" .BI "TIOCSSERIAL    const struct serial_struct *" argp
734 .\"O .\" Set serial info.
735 .\" ¥·¥ê¥¢¥ë¾ðÊó¤òÀßÄꤹ¤ë¡£
736 .\"O .SH "RETURN VALUE"
737 .SH ÊÖ¤êÃÍ
738 .\"O The
739 .\"O .BR ioctl ()
740 .\"O system call returns 0 on success.
741 .\"O On error it returns \-1 and sets
742 .\"O .I errno
743 .\"O appropriately.
744 .BR ioctl ()
745 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¡¢À®¸ù¤·¤¿¾ì¹ç¤Ï 0 ¤òÊÖ¤¹¡£
746 ¥¨¥é¡¼¤Î¾ì¹ç¤Ï \-1 ¤òÊÖ¤·¡¢
747 .I errno
748 ¤òŬÀÚ¤ËÀßÄꤹ¤ë¡£
749 .\"O .SH ERRORS
750 .SH ¥¨¥é¡¼
751 .TP
752 .B EINVAL
753 .\"O Invalid command parameter.
754 ÉÔÀµ¤Ê¥³¥Þ¥ó¥É°ú¤­¿ô¤Ç¤¢¤ë¡£
755 .TP
756 .B ENOIOCTLCMD
757 .\"O Unknown command.
758 ÉÔÌÀ¤Ê¥³¥Þ¥ó¥É¤Ç¤¢¤ë¡£
759 .TP
760 .B ENOTTY
761 .\"O Inappropriate
762 .\"O .IR fd .
763 .I fd
764 ¤¬ÉÔŬÀڤǤ¢¤ë¡£
765 .TP
766 .B EPERM
767 .\"O Insufficient permission.
768 ¸¢¸Â¤¬ÉÔ­¤·¤Æ¤¤¤ë¡£
769 .\"O .SH EXAMPLE
770 .SH Îã
771 .\"O Check the condition of DTR on the serial port.
772 ¥·¥ê¥¢¥ë¥Ý¡¼¥È¤Î DTR ¤Î¾õÂÖ¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡£
773
774 .nf
775 #include <termios.h>
776 #include <fcntl.h>
777 #include <sys/ioctl.h>
778
779 int
780 main(void)
781 {
782     int fd, serial;
783
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 ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¡£");
789     else
790 .\"O         puts("TIOCM_DTR is set");
791         puts("TIOCM_DTR ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¡£");
792     close(fd);
793 }
794 .fi
795 .\"O .SH "SEE ALSO"
796 .SH ´ØÏ¢¹àÌÜ
797 .BR ioctl (2),
798 .BR termios (3),
799 .BR console_ioctl (4),
800 .BR pty (7)
801 .\"
802 .\" FIONBIO                     const int *
803 .\" FIONCLEX                    void
804 .\" FIOCLEX                     void
805 .\" FIOASYNC                    const int *
806 .\"O .\" from serial.c:
807 .\" 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 (¾åµ­¤ò»²¾È)