OSDN Git Service

Convert release and draft pages to UTF-8.
[linuxjm/jm.git] / manual / modutils / release / man2 / init_module.2
1 .\" Copyright (C) 1996 Free Software Foundation, Inc.
2 .\" This file is distributed accroding to the GNU General Public License.
3 .\" See the file COPYING in the top level source directory for details.
4 .\"
5 .\" Japanese Version Copyright (c) 1997,1999 HANATAKA Shinya and FUJIWARA Teruyoshi
6 .\"         all rights reserved.
7 .\" Translated Sat Aug 30 13:53:25 JST 1997
8 .\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
9 .\" Merged with another translation Sun Aug 15 10:39:49 JST 1999
10 .\"         by FUJIWARA Teruyoshi <fujiwara@linux.or.jp>
11 .\"
12 .\"WORD:        loadable module         ローダブルモジュール
13 .\"
14 .TH INIT_MODULE 2 "26 Dec 1996" "Linux 2.1.17" "Linux Module Support"
15 .SH 名前
16 init_module \- ローダブルモジュールのエントリを初期化する
17 .SH 書式
18 .nf
19 .B #include <linux/module.h>
20 .sp
21 .BI "int init_module(const char *" name ", struct module *" image );
22 .fi
23 .SH 説明
24 .B init_module
25 は再配置されたモジュールイメージをカーネル空間にロードし、その
26 モジュールの \fIinit\fP 関数を実行する。
27 .PP
28 モジュールイメージは、先頭部分にモジュール構造体が置かれ、その後に適切
29 なコードとデータが配置される。モジュール構造体の定義を以下に示す:
30 .PP
31 .RS
32 .nf
33 struct module
34 {
35   unsigned long size_of_struct;
36   struct module *next;
37   const char *name;
38   unsigned long size;
39   long usecount;
40   unsigned long flags;
41   unsigned int nsyms;
42   unsigned int ndeps;
43   struct module_symbol *syms;
44   struct module_ref *deps;
45   struct module_ref *refs;
46   int (*init)(void);
47   void (*cleanup)(void);
48   const struct exception_table_entry *ex_table_start;
49   const struct exception_table_entry *ex_table_end;
50 #ifdef __alpha__
51   unsigned long gp;
52 #endif
53 };
54 .fi
55 .RE
56 .PP
57 \fInext\fP と \fIrefs\fP 以外の全てのポインタ要素は、
58 モジュールの本体内部を指し、カーネル空間での適切な値で初期化される
59 (つまりモジュールの残りの部分と共に再配置される)ことが期待される。
60 .PP
61 このシステムコールを使えるのはユーパーユーザだけである。
62 .SH 返り値
63 成功した場合は 0 が返される。エラーの場合は \-1 が返され、\fIerrno\fP 
64 に適切な値が設定される。
65 .SH エラー
66 .TP
67 .B EPERM
68 呼び出しを行ったユーザがスーパーユーザでない。
69 .TP
70 .B ENOENT
71 その名前を持つモジュールが存在しない。
72 .TP
73 .B EINVAL
74 \fIimage\fP スロットの一部に誤った値が入っているか、
75 \fIimage->name\fP が元のモジュールの名前に一致していないか、
76 \fIimage->deps\fP エントリの一部がロードされたモジュールに対応していない。
77 あるいは同様の別の矛盾が起きている。
78 .TP
79 .B EBUSY
80 モジュールの初期化ルーチンが失敗した。
81 .TP
82 .B EFAULT
83 \fIname\fP あるいは \fIimage\fP が、プログラムがアクセスできる
84 アドレス空間の外部である。
85 .SH 関連項目
86 .BR create_module "(2), " delete_module "(2), " query_module "(2)"
87