table of contents
other versions
- wheezy 3.44-1
- jessie 3.74-1
- jessie-backports 4.10-2~bpo8+1
- testing 4.10-2
- unstable 4.10-2
other languages
INIT_MODULE(2) | Linux Programmer's Manual | INIT_MODULE(2) |
NAME¶
init_module - load a kernel moduleSYNOPSIS¶
int init_module(void *module_image, unsigned long len, const char *param_values);
DESCRIPTION¶
init_module() loads an ELF image into kernel space, performs any necessary symbol relocations, initializes module parameters to values provided by the caller, and then runs the module's init function. This system call requires privilege.RETURN VALUE¶
On success, zero is returned. On error, -1 is returned and errno is set appropriately.ERRORS¶
- EBUSY
- Timeout while trying to resolve a symbol reference by this module.
- EEXIST
- A module with this name is already loaded.
- EFAULT
- An address argument referred to a location that is outside the process's accessible address space.
- EINVAL
- param_values is invalid, or some part of the ELF image in module_image contains inconsistencies.
- ENOEXEC
- The binary image supplied in module_image is not an ELF image, or is an ELF image that is invalid or for a different architecture.
- EPERM
- The caller was not privileged (did not have the CAP_SYS_MODULE capability), or module loading is disabled (see /proc/sys/kernel/modules_disabled in proc(5)).
CONFORMING TO¶
init_module() is Linux-specific.NOTES¶
Glibc does not provide a wrapper for this system call; call it using syscall(2).Linux 2.4 and earlier¶
In Linux 2.4 and earlier, this system call was rather different:struct module { unsigned long size_of_struct; struct module *next; const char *name; unsigned long size; long usecount; unsigned long flags; unsigned int nsyms; unsigned int ndeps; struct module_symbol *syms; struct module_ref *deps; struct module_ref *refs; int (*init)(void); void (*cleanup)(void); const struct exception_table_entry *ex_table_start; const struct exception_table_entry *ex_table_end; #ifdef __alpha__ unsigned long gp; #endif };
All of the pointer fields, with the exception of next and refs, are expected to point within the module body and be initialized as appropriate for kernel space, that is, relocated with the rest of the module.
SEE ALSO¶
create_module(2), delete_module(2), query_module(2), lsmod(8), modprobe(8)COLOPHON¶
This page is part of release 3.44 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/.2012-10-18 | Linux |