.\" Copyright (C) 1996 Free Software Foundation, Inc. .\" This file is distributed according to the GNU General Public License. .\" See the file COPYING in the top level source directory for details. .\" .\" 2006-02-09, some reformatting by Luc Van Oostenryck; some .\" reformatting and rewordings by mtk .\" .\" Japanese Version Copyright (c) 2006 Akihiro MOTOKI all rights reserved. .\" Translated 2006-07-29, Akihiro MOTOKI .\" .TH QUERY_MODULE 2 2007-06-03 "Linux" "Linux Programmer's Manual" .\"O .SH NAME .SH 名前 .\"O query_module \- query the kernel for various bits pertaining to modules query_module \- モジュールに関連する各種の情報をカーネルに問い合わせる .\"O .SH SYNOPSIS .SH 書式 .nf .B #include .sp .BI "int query_module(const char *" name ", int " which ", void *" buf , .BI " size_t " bufsize ", size_t *" ret ); .fi .\"O .SH DESCRIPTION .SH 説明 .\"O .BR query_module () .\"O requests information from the kernel about loadable modules. .\"O The returned information is placed in the buffer pointed to by .\"O .IR buf . .\"O The caller must specify the size of .\"O .I buf .\"O in .\"O .IR bufsize . .\"O The precise nature and format of the returned information .\"O depend on the operation specified by .\"O .IR which . .\"O Some operations require .\"O .I name .\"O to identify a currently loaded module, some allow .\"O .I name .\"O to be NULL, indicating the kernel proper. .BR query_module () は、ローダブルモジュールに関する情報をカーネルに問い合わせる。 情報は .I buf が指し示すバッファに格納されて返される。 呼び出し元は .I buf のサイズを .I bufsize に指定しなければならない。 得られる情報の正確な意味とフォーマットは、 .I which でどの操作を指定するかによって異なる。 現在ロードされているモジュールを特定するために .I name を必要とする操作があれば、 カーネル固有であることを示す NULL を指定できる操作もある。 .\"O The following values can be specified for .\"O .IR which : .I which には以下の値を指定できる: .TP .B 0 .\"O Returns success, if the kernel supports .\"O .BR query_module (). .\"O Used to probe for availability of the system call. カーネルが .BR query_module () をサポートしている場合、成功を返す。 このシステムコールが利用可能かを調べるために使われる。 .TP .B QM_MODULES .\"O Returns the names of all loaded modules. .\"O The returned buffer consists of a sequence of null-terminated strings; .\"O .I ret .\"O is set to the number of .\"O modules. ロードされている全てのモジュールの名前を返す。 バッファには、NULL 終端された文字列が順に入る。 返されるバッファ .I ret にはモジュールの数が設定される。 .\" ret is set on ENOSPC .TP .B QM_DEPS .\"O Returns the names of all modules used by the indicated module. .\"O The returned buffer consists of a sequence of null-terminated strings; .\"O .I ret .\"O is set to the number of modules. 指定されたモジュールが使用している全モジュールの名前を返す。 バッファには、NULL 終端された文字列が順に入る。 返されるバッファ .I ret にはモジュールの数が設定される。 .\" ret is set on ENOSPC .TP .B QM_REFS .\"O Returns the names of all modules using the indicated module. .\"O This is the inverse of .\"O .BR QM_DEPS . .\"O The returned buffer consists of a sequence of null-terminated strings; .\"O .I ret .\"O is set to the number of modules. 指定されたモジュールを使用している全モジュールの名前を返す。 これは .B QM_DEPS と逆の機能である。 バッファには、NULL 終端された文字列が順に入る。 返されるバッファ .I ret にはモジュールの数が設定される。 .\" ret is set on ENOSPC .TP .B QM_SYMBOLS .\"O Returns the symbols and values exported by the kernel or the indicated .\"O module. .\"O The returned buffer is an array of structures of the following form カーネルまたは指定されたモジュールがエクスポートしているシンボルと 値を返す。 バッファのデータは、 以下の構造体の配列に NULL 終端された文字列が続く形となる。 .\" ret is set on ENOSPC .in +4n .nf struct module_symbol { unsigned long value; unsigned long name; }; .fi .in .IP .\"O followed by null-terminated strings. .\"O The value of .\"O .I name .\"O is the character offset of the string relative to the start of .\"O .IR buf ; .\"O .I ret .\"O is set to the number of symbols. .I name の値は、 .I buf の先頭からの文字列までのオフセット文字数である。 .I ret にはシンボルの数が設定される。 .TP .B QM_INFO .\"O Returns miscellaneous information about the indicated module. .\"O The output buffer format is: 指定されたモジュールに関する様々な情報を返す。 出力バッファのフォーマットは以下の形式となる: .in +4n .nf struct module_info { unsigned long address; unsigned long size; unsigned long flags; }; .fi .in .IP .\"O where .\"O .I address .\"O is the kernel address at which the module resides, .\"O .I size .\"O is the size of the module in bytes, and .\"O .I flags .\"O is a mask of .\"O .BR MOD_RUNNING , .\"O .BR MOD_AUTOCLEAN , .\"O etc. that indicates the current status of the module .\"O (see the kernel source file .\"O .IR include/linux/module.h ). .\"O .I ret .\"O is set to the size of the .\"O .I module_info .\"O structure. .I address はそのモジュールが配置されているカーネル空間上のアドレス、 .I size はそのモジュールのバイト単位のサイズ、 .I flags は .BR MOD_RUNNING , .B MOD_AUTOCLEAN 等のマスクであり、そのモジュールの現在の状態を示す (カーネルのソースファイル .I include/linux/module.h を参照)。 .I ret には .I module_info 構造体のサイズが設定される。 .\"O .SH "RETURN VALUE" .SH 返り値 .\"O On success, zero is returned. .\"O On error, \-1 is returned and .\"O .I errno .\"O is set appropriately. 成功の場合 0 が返される。エラーの場合 \-1 が返され、 .I errno に適切な値が設定される。 .\"O .SH ERRORS .SH エラー .TP .B EFAULT .\"O At least one of .\"O .IR name , .\"O .IR buf , .\"O or .\"O .I ret .\"O was outside the program's accessible address space. .IR name , .IR buf , .I ret の少なくとも一つが、プログラムがアクセスできる アドレス空間の外部であった。 .TP .B EINVAL .\"O Invalid .\"O .IR which ; .\"O or .\"O .I name .\"O is NULL (indicating "the kernel"), .\"O but this is not permitted with the specified value of .\"O .IR which . .I which が不正である。あるいは .I name が NULL だが (NULL は "カーネル" を示す)、 .I which で指定された値との組み合わせは許可されていない。 .\" Not permitted with QM_DEPS, QM_REFS, or QM_INFO. .TP .B ENOENT .\"O No module by that .\"O .I name .\"O exists. .I name という名前のモジュールが存在しない。 .TP .B ENOSPC .\"O The buffer size provided was too small. .\"O .I ret .\"O is set to the minimum size needed. 与えられたバッファの大きさが小さすぎる。 .I ret には最小限必要なバッファのサイズが設定される。 .TP .B ENOSYS .\"O .BR query_module () .\"O is not supported in this version of the kernel. .BR query_module () はこのバージョンのカーネルではサポートされていない。 .\"O .SH "CONFORMING TO" .SH 準拠 .\"O .BR query_module () .\"O is Linux-specific. .BR query_module () は Linux 固有である。 .\"O .SH NOTES .SH 注意 .\"O This system call is only present on Linux up until kernel 2.4; .\"O it was removed in Linux 2.6. .\"O .\" Removed in Linux-2.5.48 .\"O Some of the information that was available via .\"O .BR query_module () .\"O can be obtained from .\"O .IR /proc/modules , .\"O .IR /proc/kallsyms , .\"O and .\"O .IR /sys/modules . このシステムコールが存在するのはカーネル 2.4 までの Linux だけである。 Linux 2.6 では削除された。 .\" Removed in Linux 2.5.48 .BR query_module () で得られた情報のいくつかは、 .IR /proc/modules , .IR /proc/kallsyms , .I /sys/modules から取得できる。 .\"O .SH "SEE ALSO" .SH 関連項目 .BR create_module (2), .BR delete_module (2), .BR get_kernel_syms (2), .BR init_module (2)