名前
- Provided by: manpages-ja-dev (Version: 0.5.0.0.20140515+dfsg-2)
- Source: manpages-ja
- Report a bug
#include <linux/module.h> int init_module(const char *name, struct module *image);
init_module() は再配置されたモジュールイメージをカーネル空間にロードし、 そのモジュールの init 関数を実行する。
モジュールイメージは先頭部分に module 構造体があり、その後ろに 適切なコードとデータが続く。 この module 構造体は以下のように定義されている:
struct module {
unsigned long size_of_struct;
struct module *next;
const char *name;
unsigned long size;
long usecount;
unsigned long flags;
unsigned int nsyms;
unsigned int ndeps;
struct module_symbol *syms;
struct module_ref *deps;
struct module_ref *refs;
int (*init)(void);
void (*cleanup)(void);
const struct exception_table_entry *ex_table_start;
const struct exception_table_entry *ex_table_end;
#ifdef __alpha__
unsigned long gp;
#endif
};
next と refs 以外の全てのポインタ要素はモジュール本体内部を指し、 カーネル空間での適切な値で初期化される (つまり、モジュールの残りの 部分で再配置される) ことが期待される。
このシステムコールを使うには特権が必要である。
成功の場合 0 が返される。エラーの場合 -1 が返され、 errno に適切な値が設定される。
init_module() は Linux 固有である。
この man ページは Linux man-pages プロジェクトのリリース 3.41 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man-pages/ に書かれている。