init_moduleのヘルプ・マニュアル
日本語 英語
init_module --help
man init_module
INIT_MODULE(2) Linux Programmer’s Manual INIT_MODULE(2)
名前
init_module - ローダブルモジュールのエントリを初期化する
書式
#include
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 を適切に設定する。
エラー
EBUSY モジュールの初期化ルーチンが失敗した。
EFAULT name や image がプログラムがアクセスできるアドレス空間の外部にあ
る。
EINVAL 一部の image スロットにおかしな 値 が 入 っ て い る 。 ま た は
image->name が元のモジュール名と一致していない。または、一部の
image->deps エントリがロードされたモジュールに対応していない。ま
たは、他に同様の矛盾が起こっている。
ENOENT その名前のモジュールが存在しない。
EPERM 呼び出し元が特権 (CAP_SYS_MODULE ケーパビリティ) を持っていなか
った。
準拠
init_module() は Linux 固有である。
関連項目
create_module(2), delete_module(2), query_module(2)
Linux 2006-02-09 INIT_MODULE(2)
INIT_MODULE(2) Linux Programmer’s Manual INIT_MODULE(2)
NAME
init_module - initialize a loadable module entry
SYNOPSIS
#include
int init_module(const char *name, struct module *image);
DESCRIPTION
init_module() loads the relocated module image into kernel space and
runs the module’s init function.
The module image begins with a module structure and is followed by code
and data as appropriate. The module structure is defined as follows:
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
};
All of the pointer fields, with the exception of next and refs, are
expected to point within the module body and be initialized as appro-
priate for kernel space, that is, relocated with the rest of the mod-
ule.
This system call requires privilege.
RETURN VALUE
On success, zero is returned. On error, -1 is returned and errno is
set appropriately.
ERRORS
EBUSY The module’s initialization routine failed.
EFAULT name or image is outside the program’s accessible address space.
EINVAL Some image slot is filled in incorrectly, image->name does not
correspond to the original module name, some image->deps entry
does not correspond to a loaded module, or some other similar
inconsistency.
ENOENT No module by that name exists.
EPERM The caller was not privileged (did not have the CAP_SYS_MODULE
capability).
CONFORMING TO
init_module() is Linux-specific.
SEE ALSO
create_module(2), delete_module(2), query_module(2)
COLOPHON
This page is part of release 3.22 of the Linux man-pages project. A
description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2006-02-09 INIT_MODULE(2)