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.
5 .TH INIT_MODULE 2 "26 Dec 1996" "Linux 2.1.17" "Linux Module Support"
7 init_module \- initialize a loadable module entry
10 .B #include <linux/module.h>
12 .BI "int init_module(const char *" name ", struct module *" image );
16 loads the relocated module image into kernel space and runs the
17 module's \fIinit\fP function.
19 The module image begins with a module structure and is followed by
20 code and data as appropriate. The module structure is defined as follows:
26 unsigned long size_of_struct;
34 struct module_symbol *syms;
35 struct module_ref *deps;
36 struct module_ref *refs;
38 void (*cleanup)(void);
39 const struct exception_table_entry *ex_table_start;
40 const struct exception_table_entry *ex_table_end;
48 All of the pointer fields, with the exception of \fInext\fP and
49 \fIrefs\fP, are expected to point within the module body and be
50 initialized as appropriate for kernel space, i.e. relocated with
51 the rest of the module.
53 This system call is only open to the superuser.
55 On success, zero is returned. On error, \-1 is returned and \fIerrno\fP
60 The user is not the superuser.
63 No module by that name exists.
66 Some \fIimage\fP slot filled in incorrectly, \fIimage->name\fP does not
67 correspond to the original module name, some \fIimage->deps\fP entry
68 does not correspond to a loaded module, or some other similar inconsistency.
71 The module's initialization routine failed.
74 \fIname\fP or \fIimage\fP
75 is outside the program's accessible address space.
77 .BR create_module "(2), " delete_module "(2), " query_module "(2)."