OSDN Git Service

a2328a36c0988e5a284ec37f93bd4f6b06884c82
[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 (2)
24 .\"O call for terminals and serial ports accepts many possible command arguments.
25 端末とシリアルポートについての
26 .BR ioctl (2)
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 (2)
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 (2)
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 (上記を参照)