您的位置:首页 > 其它

Hello Wold 模块

2012-10-12 21:07 211 查看
/***************20121012*********************/

#include <linux/init.h>

#include <linux/module.h>

MODULE_LICENSE("Dual BSD/GPL");

//特殊的宏,采用自由许可证 如果没有,内核在装载该模块时会产生抱怨

/*when use by downing*/

static int hello_init(void)

{

printk(KERN_ALERT "hello, world \n");

return 0;

}

/*use when remove*/

static void hello_exit(void)

{

printk(KERN_ALERT "Goodbye, cruel world \n");

}

module_init(hello_init);

module_init(hello_exit);

/*后记*/

/*编写驱动程序退出时,必须撤出初始化函数所做的一切,这与应用程序的最大不同。否则,在系统重新引导之前某些东西就会残留在系统*/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: