1INIT_MODULE(2)             Linux Programmer's Manual            INIT_MODULE(2)
2
3
4

NAME

6       init_module - initialize a loadable module entry
7

SYNOPSIS

9       #include <linux/module.h>
10
11       int init_module(const char *name, struct module *image);
12

DESCRIPTION

14       init_module()  loads  the  relocated module image into kernel space and
15       runs the module's init function.
16
17       The module image begins with a module structure and is followed by code
18       and data as appropriate.  The module structure is defined as follows:
19
20           struct module {
21               unsigned long         size_of_struct;
22               struct module        *next;
23               const char           *name;
24               unsigned long         size;
25               long                  usecount;
26               unsigned long         flags;
27               unsigned int          nsyms;
28               unsigned int          ndeps;
29               struct module_symbol *syms;
30               struct module_ref    *deps;
31               struct module_ref    *refs;
32               int                 (*init)(void);
33               void                (*cleanup)(void);
34               const struct exception_table_entry *ex_table_start;
35               const struct exception_table_entry *ex_table_end;
36           #ifdef __alpha__
37               unsigned long gp;
38           #endif
39           };
40
41       All  of  the  pointer  fields, with the exception of next and refs, are
42       expected to point within the module body and be initialized  as  appro‐
43       priate  for  kernel space, that is, relocated with the rest of the mod‐
44       ule.
45
46       This system call requires privilege.
47

RETURN VALUE

49       On success, zero is returned.  On error, -1 is returned  and  errno  is
50       set appropriately.
51

ERRORS

53       EBUSY  The module's initialization routine failed.
54
55       EFAULT name or image is outside the program's accessible address space.
56
57       EINVAL Some  image  slot is filled in incorrectly, image->name does not
58              correspond to the original module name, some  image->deps  entry
59              does  not  correspond  to a loaded module, or some other similar
60              inconsistency.
61
62       ENOENT No module by that name exists.
63
64       EPERM  The caller was not privileged (did not have  the  CAP_SYS_MODULE
65              capability).
66

CONFORMING TO

68       init_module() is Linux-specific.
69

SEE ALSO

71       create_module(2), delete_module(2), query_module(2)
72

COLOPHON

74       This  page  is  part of release 3.22 of the Linux man-pages project.  A
75       description of the project, and information about reporting  bugs,  can
76       be found at http://www.kernel.org/doc/man-pages/.
77
78
79
80Linux                             2006-02-09                    INIT_MODULE(2)
Impressum