如何确定Linux内核中是否加载了特定模块 [英] How to determine if a specific module is loaded in linux kernel

查看:425
本文介绍了如何确定Linux内核中是否加载了特定模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很好奇,是否有任何方法可以确定是否已加载/安装了特定模块.

I am just curious is there any way to determine if a particular module is loaded/installed.

$ lsmod列出所有模块(已加载设备驱动程序).

$lsmod lists all modules (device driver loaded).

是否有任何方法可以检查,或者如果轮询了模块名称,则该命令返回true/false布尔输出.例如如果keyboard.o存在,则返回true,否则返回false.我需要此提示来完成我的驱动程序自动刷新程序.

Is there any way to check or a command that returns true/false boolean output if a module name is polled. for eg. if keyboard.o exists return true else false. i need this tip to complete my driver auto refresh program.

PS:尝试使用modinfo.我在测试DUT中使用busybox客户端,所以您能提供modinfo以外的其他替代方法吗?

PS: tried modinfo. i am using busybox client in my test DUT so can you give some alternatives other than modinfo ?

推荐答案

不确定modinfo modname并检查$?是否对您有用,只是一个建议.

not sure if modinfo modname and checking $? will work for you, just a suggestion.

/tmp$ sudo modinfo e1000
/tmp$ echo $?
0
/tmp$ sudo modinfo keyboard
ERROR: modinfo: could not find module keyboard
/tmp$ echo $?
1

或者您也grep /proc/modules

这篇关于如何确定Linux内核中是否加载了特定模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆