Linux 内核模块的位置
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4654990/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Location of Linux Kernel Module
提问by user567879
Is there any utiliy, that shows where the location of the module I have loaded.
是否有任何实用程序可以显示我加载的模块的位置。
采纳答案by bdonlan
If you want to know the base memory address for a module in the kernel's virtual address space, it can be found as the last field in /proc/modules
; search for the module in question:
如果你想知道内核虚拟地址空间中某个模块的基内存地址,可以在/proc/modules
; 中的最后一个字段中找到。搜索相关模块:
$ grep '^ext3' /proc/modules
ext3 125513 1 - Live 0xf88ce000
If you want to know the file path it was loaded from, the original path is not actually stored anywhere, but you can ask modprobe
to search for the module again and display the path using modprobe -l
:
如果您想知道加载它的文件路径,原始路径实际上并未存储在任何地方,但您可以要求modprobe
再次搜索模块并使用modprobe -l
以下命令显示路径:
$ /sbin/modprobe -l ext3
/lib/modules/2.6.18-194.el5PAE/kernel/fs/ext3/ext3.ko
Assuming you haven't changed anything in the module search path in the intervening time, this should give you the original load path.
假设您在此期间没有更改模块搜索路径中的任何内容,这应该为您提供原始加载路径。
EDIT: As of 2015, the information isn't correct (not only that ext4 doesn't exist as a kernel module). Get information about the module, including the path of the image with:
编辑:截至 2015 年,信息不正确(不仅 ext4 不作为内核模块存在)。获取有关模块的信息,包括图像的路径:
modinfo floppy
modinfo floppy
回答by Ignacio Vazquez-Abrams
No. This information is not retained when the module is loaded.
否。加载模块时不会保留此信息。
回答by Uri
The information above isn't correct, for 2015.
以上信息不正确,2015 年。
modinfo will now give you information about the module. for example:
modinfo floppy
modinfo 现在将为您提供有关该模块的信息。例如:
modinfo floppy