1 .\" Copyright (c) 1980, 1991 Regents of the University of California.
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" @(#)ioctl.2 6.4 (Berkeley) 3/10/91
34 .\" Modified 1993-07-23 by Rik Faith <faith@cs.unc.edu>
35 .\" Modified 1996-10-22 by Eric S. Raymond <esr@thyrsus.com>
36 .\" Modified 1999-06-25 by Rachael Munns <vashti@dream.org.uk>
37 .\" Modified 2000-09-21 by Andries Brouwer <aeb@cwi.nl>
39 .\" Japanese Version Copyright (c) 1997-1999 HANATAKA Shinya
40 .\" all rights reserved.
41 .\" Translated Sat Aug 14 10:10:27 JST 1999
42 .\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
43 .\" Modified 2002-09-24 by Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
44 .\" Updated 2005-02-24, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
45 .\" Updated 2011-08-10, TACHIBANA Akira <tati@kc5.so-net.ne.jp>
46 .\" Updated 2011-09-15, TACHIBANA Akira <tati@kc5.so-net.ne.jp>
50 .\"WORD: special スペシャル
51 .\"WORD: character キャラクタ
52 .\"WORD: parameter パラメータ
55 .\"WORD: request リクエスト
56 .\"WORD: descriptor ディスクリプタ
59 .\"WORD: operating characteristics 動作特性
61 .TH IOCTL 2 2000-09-21 "Linux" "Linux Programmer's Manual"
63 .\"O ioctl \- control device
68 .B #include <sys/ioctl.h>
70 .BI "int ioctl(int " d ", int " request ", ...);"
75 .\"O function manipulates the underlying device parameters of special files.
76 .\"O In particular, many operating characteristics of character special files
77 .\"O (e.g., terminals) may be controlled with
82 .\"O must be an open file descriptor.
84 関数はスペシャル・ファイルを構成するデバイスのパラメータを
85 操作する。特に、キャラクタ型のスペシャル・ファイル (例えば端末 (terminal))
88 リクエストによって制御することができる。引き数
90 はオープンされたファイル・ディスクリプタでなければならない。
92 .\"O The second argument is a device-dependent request code.
93 .\"O The third argument is an untyped pointer to memory.
94 .\"O It's traditionally
95 .\"O .BI "char *" argp
96 .\"O (from the days before
98 .\"O was valid C), and will be so named for this discussion.
99 2 番目の引き数は、デバイス依存のリクエスト・コードである。
100 3 番目の引き数は、メモリへの型を指定しないポインタである。
105 と表記されている。したがって、この文章でもそう名付けることとする。
110 .\"O has encoded in it whether the argument is an
114 .\"O parameter, and the size of the argument
117 .\"O Macros and defines used in specifying an
120 .\"O are located in the file
121 .\"O .IR <sys/ioctl.h> .
132 引き数のバイト単位のサイズ、といった情報がエンコードされている。
136 を指定するためのマクロ (macro) と定義は
139 .\"O .SH "RETURN VALUE"
141 .\"O Usually, on success zero is returned.
144 .\"O requests use the return value as an output parameter
145 .\"O and return a nonnegative value on success.
146 たいていの場合、成功するとゼロが返される。
149 リクエストの中にはパラメータの出力に返り値を使用しているものが若干あり、
150 その場合は、成功したときに非負の値が返される。
151 .\"O On error, \-1 is returned, and
153 .\"O is set appropriately.
162 .\"O is not a valid descriptor.
168 .\"O references an inaccessible memory area.
184 .\"O is not associated with a character special device.
186 がキャラクタ型のスペシャル・デバイスを参照していない。
189 .\"O The specified request does not apply to the kind of object that the
195 が参照する種類のオブジェクトには適用することができない。
196 .\"O .SH CONFORMING TO
198 .\"O No single standard.
199 .\"O Arguments, returns, and semantics of
201 .\"O vary according to the device driver in question (the call is used as a
202 .\"O catch-all for operations that don't cleanly fit the UNIX stream I/O
205 .\"O .BR ioctl_list (2)
206 .\"O for a list of many of the known
209 どれか一つの標準に対応しているわけではない。
211 の引き数、返り値、解釈は、処理対象のデバイス・ドライバごとに
212 異なる (この関数は UNIX の ストリーム I/O モデル に
213 きちんと適合していない操作のための便利屋として使用される)。
221 .\"O function call appeared in Version 7 AT&T UNIX.
223 関数コールは Version 7 AT&T UNIX で登場した。
226 .\"O In order to use this call, one needs an open file descriptor.
229 .\"O call has unwanted side effects, that can be avoided under Linux
230 .\"O by giving it the
233 このシステムコールを使うには、オープンされたファイル・ディスクリプタが
236 コールはしばしば望んでいない副作用を伴うことがあるが、Linux では
240 フラグをつけることでこの副作用を避けることができる。