init_module
来源:互联网 发布:星火网络电视 编辑:程序博客网 时间:2024/06/08 09:09
原文:
NAME
init_module - initialize a loadable module entrySYNOPSIS
#include <linux/module.h>int init_module(const char *name, struct module *image);
DESCRIPTION
init_module loads the relocated module image into kernel space and runs the module's initfunction.The module image begins with a module structure and is followed by code and data as appropriate. The module structure is defined as follows:
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, i.e. relocated with the rest of the module.
This system call is only open to the superuser.
RETURN VALUE
On success, zero is returned. On error, -1 is returned and errno is set appropriately.ERRORS
- EPERM
- The user is not the superuser.
- ENOENT
- No module by that name exists.
- EINVAL
- Some image slot filled in incorrectly, image->name does not correspond to the original module name, some image->deps entry does not correspond to a loaded module, or some other similar inconsistency.
- EBUSY
- The module's initialization routine failed.
- EFAULT
- name or image is outside the program's accessible address space.
- 译文:
- NAME
init_module - 初始化一条可加载模块的记录.
总览
#include <linux/module.h>
int init_module(const char *name, struct module *image);
描述
init_module加载已被重定位的模块映象到内核空间,并运行模块的初始化函数. 模块映象以module结构开始,紧跟着代码和数据,module定义如下:
struct module
{
unsigned long size_of_struct; /* module结构的大小 */
struct module *next; /*指向下一个module结构 */
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
}; 除了next和refs外,所有的指针被期望指在模块体内, 该系统调用只对超级用户开放.
返回值
成功时返回0,错误时返回 -1,errno被相应设置.
错误
EPERM
用户不是超级用户.
ENOENT
name指定的模块不存在.
EINVAL
EBUSY
模块的初始化函数失败.
EFAULT
name或image越出了程序可访问的地址空间.
- init_module
- module_init和init_module的区别
- init_module 加载内核模块文件
- module_init和module_exit,init_module和cleanup_module
- insmod问题: init_module xxxxx.ko' failed (Operation not permitted)
- insmod: init_module 'hello.ko' failed (Exec format error)
- ok6410开发板android底层驱动模块编写,出现insmod:init_module ‘hello.ko’ failed (Exec format error)
- jquery 自定义插件小结
- CSS3动画——也在3 d
- 汇编学习笔记(三)
- Delphi for iOS开发指南(14):在iOS应用程序中使用InterBase ToGo
- Oracle错误代码大全
- init_module
- #pragma data_seg()
- Delphi for iOS开发指南(15):在iOS应用程序中使用SQLite
- 扬创uboot移植(2)--基于《嵌入式Linux之我行--u-boot-2009.08在2440上的移植详解》
- 获得Linux系统中的IP、MAC地址等信息
- 【Java设计模式之Observer】
- ClientToScreen ScreenToClient MoveWindow
- 关于std::map中的find和[]的问题
- 对于linux下system()函数的深度理解(整理)