2019-12-24 14:10:39 +11:00
## Name
module\_load - load a kernel module
## Synopsis
```**c++
#include <serenity.h>
int module_load(const char* path, size_t path_length);
```
## Description
`module_load()` will load a kernel module from an ELF object file given its
path in the filesystem.
## Return value
If the module is successfully loaded, `module_load()` returns 0. Otherwise, it
returns -1 and sets `errno` to describe the error.
## Errors
2020-01-02 12:35:19 +01:00
* `EPERM` : The calling process does not have superuser permissions.
2019-12-24 14:10:39 +11:00
* `EFAULT` : `path` pointed to memory that was not accessible for the caller.
* `ENOEXEC` : The specified file could not be parsed as an ELF object.
2020-01-19 01:22:40 +03:00
* `EINVAL` : One or more symbols referred to by the module could not be resolved, or the module had no `.text` section, or didn't export a `module_init` function.
2019-12-24 14:10:39 +11:00
* `EEXIST` : A module with the same name was already loaded.
## See also
* [`module_unload`(2) ](module_unload.md )
* [`modload`(1) ](../man1/modload.md )
* [`kernel_modules`(7) ](../man7/kernel_modules.md )