QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1822|回复: 3

hello world内核模块不能卸载,提示设备忙!

[复制链接]
发表于 2005-9-22 09:58:40 | 显示全部楼层 |阅读模式
[code:1]
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/signal.h>

static int __init test_init()
{
        printk("test_init\n");
        return 0;
}

static void __exit test_exit()
{
        printk("exit\n");
}

module_init(test_init);
module_cleanup(test_exit);

[/code:1]

rmmod test就提示
ERROR: Removing 'test': Device or resource busy

lsmod看了一下test模块跟别的有点不一样
test                    1792  0 [permanent]
多了个[permanent]

怎么回事?
发表于 2005-9-24 14:46:02 | 显示全部楼层
友情帮顶
回复

使用道具 举报

 楼主| 发表于 2005-9-30 13:31:44 | 显示全部楼层
哈,原来是module_exit不是module_cleanup
回复

使用道具 举报

发表于 2005-10-17 15:50:48 | 显示全部楼层
modprobe -r test
这个命令强!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-5-6 14:23 , Processed in 0.052259 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表