OSDN Git Service

92f3f37827995c9866331d99029daf6279765d24
[linuxjm/LDP_man-pages.git] / release / man2 / init_module.2
1 .\" Copyright (C) 1996 Free Software Foundation, Inc.
2 .\" This file is distributed according to the GNU General Public License.
3 .\" See the file COPYING in the top level source directory for details.
4 .\"
5 .\" 2006-02-09, some reformatting by Luc Van Oostenryck; some
6 .\" reformatting and rewordings by mtk
7 .\"
8 .\" Japanese Version Copyright (c) 2006 Akihiro MOTOKI all rights reserved.
9 .\" Translated 2006-07-29, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
10 .\"
11 .TH INIT_MODULE 2 2006-02-09 "Linux" "Linux Programmer's Manual"
12 .SH 名前
13 init_module \- ローダブルモジュールのエントリを初期化する
14 .SH 書式
15 .nf
16 .B #include <linux/module.h>
17 .sp
18 .BI "int init_module(const char *" name ", struct module *" image );
19 .fi
20 .SH 説明
21 .BR init_module ()
22 は再配置されたモジュールイメージをカーネル空間にロードし、
23 そのモジュールの
24 .I init
25 関数を実行する。
26 .PP
27 モジュールイメージは先頭部分に module 構造体があり、その後ろに
28 適切なコードとデータが続く。
29 この module 構造体は以下のように定義されている:
30 .PP
31 .in +4n
32 .nf
33 struct module {
34     unsigned long         size_of_struct;
35     struct module        *next;
36     const char           *name;
37     unsigned long         size;
38     long                  usecount;
39     unsigned long         flags;
40     unsigned int          nsyms;
41     unsigned int          ndeps;
42     struct module_symbol *syms;
43     struct module_ref    *deps;
44     struct module_ref    *refs;
45     int                 (*init)(void);
46     void                (*cleanup)(void);
47     const struct exception_table_entry *ex_table_start;
48     const struct exception_table_entry *ex_table_end;
49 #ifdef __alpha__
50     unsigned long gp;
51 #endif
52 };
53 .fi
54 .in
55 .PP
56 .I next
57
58 .I refs
59 以外の全てのポインタ要素はモジュール本体内部を指し、
60 カーネル空間での適切な値で初期化される (つまり、モジュールの残りの
61 部分で再配置される) ことが期待される。
62 .PP
63 このシステムコールを使うには特権が必要である。
64 .SH 返り値
65 成功すると 0 を返す。エラーの場合 \-1 を返し、
66 .I errno
67 を適切に設定する。
68 .SH エラー
69 .TP
70 .B EBUSY
71 モジュールの初期化ルーチンが失敗した。
72 .TP
73 .B EFAULT
74 .I name
75
76 .I image
77 がプログラムがアクセスできるアドレス空間の外部にある。
78 .TP
79 .B EINVAL
80 一部の
81 .I image
82 スロットにおかしな値が入っている。または
83 .I image\->name
84 が元のモジュール名と一致していない。または、一部の
85 .I image\->deps
86 エントリがロードされたモジュールに対応していない。
87 または、他に同様の矛盾が起こっている。
88 .TP
89 .B ENOENT
90 その名前のモジュールが存在しない。
91 .TP
92 .B EPERM
93 呼び出し元が特権
94 .RB ( CAP_SYS_MODULE
95 ケーパビリティ) を持っていなかった。
96 .SH 準拠
97 .BR init_module ()
98 は Linux 固有である。
99 .SH 関連項目
100 .BR create_module (2),
101 .BR delete_module (2),
102 .BR query_module (2)