]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/init_module.2
grfix
[thirdparty/man-pages.git] / man2 / init_module.2
CommitLineData
c4d4162c
MK
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.\"
c13182ef 5.\" 2006-02-09, some reformatting by Luc Van Oostenryck; some
c4d4162c
MK
6.\" reformatting and rewordings by mtk
7.\"
e127c16a 8.TH INIT_MODULE 2 2006-02-09 "Linux" "Linux Programmer's Manual"
c4d4162c
MK
9.SH NAME
10init_module \- initialize a loadable module entry
11.SH SYNOPSIS
12.nf
13.B #include <linux/module.h>
14.sp
15.BI "int init_module(const char *" name ", struct module *" image );
16.fi
17.SH DESCRIPTION
18.BR init_module ()
19loads the relocated module image into kernel space and runs the
20module's
21.I init
22function.
23.PP
24The module image begins with a module structure and is followed by
25code and data as appropriate.
26The module structure is defined as follows:
27.PP
a6e2f128 28.in +4n
c4d4162c
MK
29.nf
30struct module {
31 unsigned long size_of_struct;
32 struct module *next;
33 const char *name;
34 unsigned long size;
35 long usecount;
36 unsigned long flags;
37 unsigned int nsyms;
38 unsigned int ndeps;
39 struct module_symbol *syms;
40 struct module_ref *deps;
41 struct module_ref *refs;
42 int (*init)(void);
43 void (*cleanup)(void);
44 const struct exception_table_entry *ex_table_start;
45 const struct exception_table_entry *ex_table_end;
46#ifdef __alpha__
47 unsigned long gp;
48#endif
49};
50.fi
a6e2f128 51.in
c4d4162c
MK
52.PP
53All of the pointer fields, with the exception of
54.I next
55and
56.IR refs ,
57are expected to point within the module body and be
75b94dc3 58initialized as appropriate for kernel space, that is, relocated with
c4d4162c
MK
59the rest of the module.
60.PP
61This system call requires privilege.
62.SH "RETURN VALUE"
c13182ef
MK
63On success, zero is returned.
64On error, \-1 is returned and
c4d4162c
MK
65.I errno
66is set appropriately.
67.SH ERRORS
68.TP
69.B EBUSY
70The module's initialization routine failed.
71.TP
72.B EFAULT
73.I name
74or
75.I image
76is outside the program's accessible address space.
77.TP
78.B EINVAL
79Some
80.I image
81slot is filled in incorrectly,
94e9d9fe 82.I image\->name
c4d4162c 83does not correspond to the original module name, some
94e9d9fe 84.I image\->deps
c13182ef 85entry does not correspond to a loaded module,
c4d4162c
MK
86or some other similar inconsistency.
87.TP
88.B ENOENT
89No module by that name exists.
90.TP
91.B EPERM
92The caller was not privileged
93(did not have the
94.B CAP_SYS_MODULE
95capability).
96.SH "CONFORMING TO"
97.BR init_module ()
8382f16d 98is Linux-specific.
c4d4162c
MK
99.SH "SEE ALSO"
100.BR create_module (2),
101.BR delete_module (2),
102.BR query_module (2)