[JM:00314] [POST:DP] LDP_man-pages ioctl.2

Back to archive index

R4000 2.2 tati****@kc5*****
2011年 8月 10日 (水) 18:49:37 JST


<STATUS>
stat: DP
ppkg: LDP_man-pages
page: ioctl.2
date: 2011/08/09
mail: tati****@kc5*****
name: TACHIBANA Akira
</STATUS>

.\" Copyright (c) 1980, 1991 Regents of the University of California.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\"    must display the following acknowledgement:
.\"	This product includes software developed by the University of
.\"	California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"     @(#)ioctl.2	6.4 (Berkeley) 3/10/91
.\"
.\" Modified 1993-07-23 by Rik Faith <faith****@cs*****>
.\" Modified 1996-10-22 by Eric S. Raymond <esr****@thyrs*****>
.\" Modified 1999-06-25 by Rachael Munns <vasht****@dream*****>
.\" Modified 2000-09-21 by Andries Brouwer <aeb****@cwi*****>
.\"
.\" Japanese Version Copyright (c) 1997-1999 HANATAKA Shinya
.\"         all rights reserved.
.\" Translated Sat Aug 14 10:10:27 JST 1999
.\"         by HANATAKA Shinya <hanat****@abyss*****>
.\" Modified 2002-09-24 by Akihiro MOTOKI <amoto****@dd*****>
.\" Updated 2005-02-24, Akihiro MOTOKI <amoto****@dd*****>
.\" Updated 2011-08-10, TACHIBANA Akira <tati****@kc5*****>
.\"
.\"WORD:	device			デバイス
.\"WORD:	control			制御する
.\"WORD:	special			スペシャル
.\"WORD:	character		キャラクタ
.\"WORD:	parameter		パラメータ
.\"WORD:	operate			操作
.\"WORD:	open			オープン
.\"WORD:	request			リクエスト
.\"WORD:	descriptor		ディスクリプタ
.\"WORD:	argument		引き数
.\"WORD:	encode			エンコード
.\"
.TH IOCTL 2 2000-09-21 "Linux" "Linux Programmer's Manual"
.\"O .SH NAME
.\"O ioctl \- control device
.SH 名前
ioctl \- デバイス (device) を制御する
.\"O .SH SYNOPSIS
.SH 書式
.B #include <sys/ioctl.h>
.sp
.BI "int ioctl(int " d ", int " request ", ...);"
.\"O .SH DESCRIPTION
.SH 説明
.\"O The
.\"O .BR ioctl ()
.\"O function manipulates the underlying device parameters of special files.
.\"O In particular, many operating characteristics of character special files
.\"O (e.g., terminals) may be controlled with
.\"O .BR ioctl ()
.\"O requests.
.\"O The argument
.\"O .I d
.\"O must be an open file descriptor.
.BR ioctl ()
関数はスペシャル・ファイルを構成するデバイスのパラメータを
操作する。特に、キャラクタ型のスペシャル・ファイル(例えば端末 (terminal) )
の多くの操作可能な特性を
.BR ioctl ()
リクエストによって制御することができる。引き数
.I d
はオープンされたファイル・ディスクリプタでなければならない。
.PP
.\"O The second argument is a device-dependent request code.
.\"O The third argument is an untyped pointer to memory.
.\"O It's traditionally
.\"O .BI "char *" argp
.\"O (from the days before
.\"O .B "void *"
.\"O was valid C), and will be so named for this discussion.
2番目の引き数は、デバイス依存のリクエスト・コードである。
3番目の引き数は、メモリへの型を指定しないポインタである。
この引き数は伝統的に (C で
.B "void *"
という書き方が有効になる前から)
.BI "char *" argp
と表記されている。したがって、この文章でもそう名付けることとする。
.PP
.\"O An
.\"O .BR ioctl ()
.\"O .I request
.\"O has encoded in it whether the argument is an
.\"O .I in
.\"O parameter or
.\"O .I out
.\"O parameter, and the size of the argument
.\"O .I argp
.\"O in bytes.
.\"O Macros and defines used in specifying an
.\"O .BR ioctl ()
.\"O .I request
.\"O are located in the file
.\"O .IR <sys/ioctl.h> .
.BR ioctl ()
の
.I request
には、
その引き数が
.I 入力
パラメータと
.I 出力
パラメータのどちらかであるかの区別や、
.I argp
引き数のバイト単位のサイズ、といった情報がエンコードされている。
.BR ioctl ()
の
.I request
を指定するためのマクロ(macro)と定義は
.I <sys/ioctl.h>
ファイルにある。
.\"O .SH "RETURN VALUE"
.SH 返り値
.\"O Usually, on success zero is returned.
.\"O A few
.\"O .BR ioctl ()
.\"O requests use the return value as an output parameter
.\"O and return a nonnegative value on success.
たいていの場合、成功するとゼロが返される。
ただし、
.BR ioctl ()
リクエストの中にはパラメータの出力に返り値を使用しているものが若干あり、
その場合は、成功したときに非負の値が返される。
.\"O On error, \-1 is returned, and
.\"O .I errno
.\"O is set appropriately.
エラーの場合は \-1 が返され、
.I errno
が適切に設定される。
.\"O .SH ERRORS
.SH エラー
.TP 0.7i
.B EBADF
.\"O .I d
.\"O is not a valid descriptor.
.I d
が有効なディスクリプタではない。
.TP
.B EFAULT
.\"O .I argp
.\"O references an inaccessible memory area.
.I argp
がアクセス不可能なメモリを参照している。
.TP
.B EINVAL
.\"O .I Request
.\"O or
.\"O .I argp
.\"O is not valid.
.I request
または
.I argp
が不正である。
.TP
.B ENOTTY
.\"O .I d
.\"O is not associated with a character special device.
.I d
がキャラクタ型のスペシャル・デバイスを参照していない。
.TP
.B ENOTTY
.\"O The specified request does not apply to the kind of object that the
.\"O descriptor
.\"O .I d
.\"O references.
指定されたリクエストはディスクリプタ
.I d
が参照する種類のオブジェクトには適用することができない。
.\"O .SH CONFORMING TO
.SH 準拠
.\"O No single standard.
.\"O Arguments, returns, and semantics of
.\"O .BR ioctl ()
.\"O vary according to the device driver in question (the call is used as a
.\"O catch-all for operations that don't cleanly fit the UNIX stream I/O
.\"O model).
.\"O See
.\"O .BR ioctl_list (2)
.\"O for a list of many of the known
.\"O .BR ioctl ()
.\"O calls.
どれか一つの標準に対応しているわけではない。
.BR ioctl ()
の引き数、返り値、解釈は、処理対象のデバイス・ドライバごとに
異なる(この関数は UNIX の ストリーム I/O モデル に
きちんと適合していない操作の便利屋として使用される)。
よく知られている
.BR ioctl ()
のリストについては
.BR ioctl_list (2)
を参照すること。
.\"O The
.\"O .BR ioctl ()
.\"O function call appeared in Version 7 AT&T UNIX.
.BR ioctl ()
関数コールは Version 7 AT&T UNIX で登場した。
.\"O .SH NOTES
.SH 注意
.\"O In order to use this call, one needs an open file descriptor.
.\"O Often the
.\"O .BR open (2)
.\"O call has unwanted side effects, that can be avoided under Linux
.\"O by giving it the
.\"O .B O_NONBLOCK
.\"O flag.
このシステムコールを使うには、オープンされたファイル・ディスクリプタが
必要である。しばしば
.BR open (2)
コールは望んでいない副作用を伴うことがあるが、Linux では
.BR open (2)
に
.B O_NONBLOCK
フラグをつけることでこの副作用を避けることができる。
.\"O .SH "SEE ALSO"
.SH 関連項目
.BR execve (2),
.BR fcntl (2),
.BR ioctl_list (2),
.BR open (2),
.\" .BR mt (4),
.BR sd (4),
.BR tty (4)




linuxjm-discuss メーリングリストの案内
Back to archive index