您的位置:首页 > 运维架构 > Linux

linux设备驱动模块引用和依赖

2016-05-12 10:15 537 查看
/modules/04 # lsmod
test 787 0 - Live 0xbf010000 (PO)
func 633 1 test, Live 0xbf00c000 (PO)		test -> func
^ 引用计数
/modules/04 # rmmod func					引用计数>0 不能卸载
rmmod: remove 'func': Resource temporarily unavailable

modprobe自动解决依赖:
/ # modprobe test
[  307.800000] test: Unknown symbol print (err 0)
[  307.850000] hello kernel		<-- insmod func.ko ; insmod test.ko
/ # lsmod
test 787 0 - Live 0xbf01c000 (PO)
func 633 1 test, Live 0xbf018000 (PO)

/ # modprobe -r func			<-- 引用计数>0 不能卸载
modprobe: remove 'func': Resource temporarily unavailable
/ # modprobe -r test			<-- rmmod test.ko ; rmmod func.ko
[  363.130000] cleanup module
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: