.\" Copyright (C) 1996 Free Software Foundation, Inc. .\" .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE) .\" This file is distributed according to the GNU General Public License. .\" %%%LICENSE_END .\" .\" 2006-02-09, some reformatting by Luc Van Oostenryck; some .\" reformatting and rewordings by mtk .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH QUERY_MODULE 2 2013\-01\-27 Linux "Linux Programmer's Manual" .SH 名前 query_module \- モジュールに関連する各種の情報をカーネルに問い合わせる .SH 書式 .nf \fB#include \fP .sp \fBint query_module(const char *\fP\fIname\fP\fB, int \fP\fIwhich\fP\fB, void *\fP\fIbuf\fP\fB,\fP \fB size_t \fP\fIbufsize\fP\fB, size_t *\fP\fIret\fP\fB);\fP .fi \fI注\fP: このシステムコールには glibc のラッパー関数は存在しない。「注意」の節を参照。 .SH 説明 \fBNote\fP: This system call is present only in kernels before Linux 2.6. \fBquery_module\fP() は、ローダブルモジュールに関する情報をカーネルに問い合わせる。 情報は \fIbuf\fP が指し示すバッファに格納されて返される。 呼び出し元は \fIbuf\fP のサイズを \fIbufsize\fP に指定しなければならない。 得られる情報の正確な意味とフォーマットは、 \fIwhich\fP でどの操作を指定するかによって異なる。 現在ロードされているモジュールを特定するために \fIname\fP を必要とする操作があれば、 カーネル固有であることを示す NULL を指定できる操作もある。 \fIwhich\fP には以下の値を指定できる: .TP \fB0\fP カーネルが \fBquery_module\fP() をサポートしている場合、成功を返す。 このシステムコールが利用可能かを調べるために使われる。 .TP \fBQM_MODULES\fP .\" ret is set on ENOSPC ロードされている全てのモジュールの名前を返す。 バッファには、NULL 終端された文字列が順に入る。 返されるバッファ \fIret\fP にはモジュールの数が設定される。 .TP \fBQM_DEPS\fP .\" ret is set on ENOSPC 指定されたモジュールが使用している全モジュールの名前を返す。 バッファには、NULL 終端された文字列が順に入る。 返されるバッファ \fIret\fP にはモジュールの数が設定される。 .TP \fBQM_REFS\fP .\" ret is set on ENOSPC 指定されたモジュールを使用している全モジュールの名前を返す。 これは \fBQM_DEPS\fP と逆の機能である。 バッファには、NULL 終端された文字列が順に入る。 返されるバッファ \fIret\fP にはモジュールの数が設定される。 .TP \fBQM_SYMBOLS\fP .\" ret is set on ENOSPC カーネルまたは指定されたモジュールがエクスポートしているシンボルと 値を返す。 バッファのデータは、 以下の構造体の配列に NULL 終端された文字列が続く形となる。 .in +4n .nf struct module_symbol { unsigned long value; unsigned long name; }; .fi .in .IP \fIname\fP の値は、 \fIbuf\fP の先頭からの文字列までのオフセット文字数である。 \fIret\fP にはシンボルの数が設定される。 .TP \fBQM_INFO\fP 指定されたモジュールに関する様々な情報を返す。 出力バッファのフォーマットは以下の形式となる: .in +4n .nf struct module_info { unsigned long address; unsigned long size; unsigned long flags; }; .fi .in .IP where \fIaddress\fP is the kernel address at which the module resides, \fIsize\fP is the size of the module in bytes, and \fIflags\fP is a mask of \fBMOD_RUNNING\fP, \fBMOD_AUTOCLEAN\fP, etc., that indicates the current status of the module (see the Linux kernel source file \fIinclude/linux/module.h\fP). \fIret\fP is set to the size of the \fImodule_info\fP structure. .SH 返り値 成功の場合 0 が返される。エラーの場合 \-1 が返され、 \fIerrno\fP に適切な値が設定される。 .SH エラー .TP \fBEFAULT\fP \fIname\fP, \fIbuf\fP, \fIret\fP の少なくとも一つが、プログラムがアクセスできる アドレス空間の外部であった。 .TP \fBEINVAL\fP .\" Not permitted with QM_DEPS, QM_REFS, or QM_INFO. \fIwhich\fP が不正である。あるいは \fIname\fP が NULL だが (NULL は "カーネル" を示す)、 \fIwhich\fP で指定された値との組み合わせは許可されていない。 .TP \fBENOENT\fP \fIname\fP という名前のモジュールが存在しない。 .TP \fBENOSPC\fP 与えられたバッファの大きさが小さすぎる。 \fIret\fP には最小限必要なバッファのサイズが設定される。 .TP \fBENOSYS\fP \fBquery_module\fP() is not supported in this version of the kernel (e.g., the kernel is version 2.6 or later). .SH バージョン .\" Removed in Linux 2.5.48 このシステムコールが存在するのはカーネル 2.4 までの Linux だけである。 Linux 2.6 では削除された。 .SH 準拠 \fBquery_module\fP() は Linux 固有である。 .SH 注意 Some of the information that was formerly available via \fBquery_module\fP() can be obtained from \fI/proc/modules\fP, \fI/proc/kallsyms\fP, and the files under the directory \fI/sys/module\fP. Glibc does not provide a wrapper for this system call; in the unlikely event that you need to use it on an old kernel, use \fBsyscall\fP(2). .SH 関連項目 \fBcreate_module\fP(2), \fBdelete_module\fP(2), \fBget_kernel_syms\fP(2), \fBinit_module\fP(2), \fBlsmod\fP(8), \fBmodinfo\fP(8) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.50 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。