如何列出正在使用/访问给定 Linux 内核驱动程序的所有进程
有没有办法列出正在使用/访问给定 Linux 内核驱动程序的所有进程?
我有一个(帧缓冲区)驱动程序,我正在尝试 rmmod,但是系统正在返回模块正在使用中,我想深入了解它并查看哪些进程仍在使用它。
我们能否首先获取系统归因于与驱动程序交互的文件描述符,然后从那里查找拥有它们的进程?
——伊利亚斯·古塔
Is there any way to list all the processes which are using/accessing a given Linux kernel driver?
I've got a (framebuffer) driver which I'm trying to rmmod, however the system is returning Module is in use, and I'd like to get to the bottom of it and see what process is still using it.
Can we get first the file descriptors that're been attributed by the system for interaction w/ the driver, then from there lookup the processes that own them?
-Ilyes Gouta
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果设备是 /dev/fb0,则 lsof /dev/fb0 应列出打开该设备的进程。
它也可能被另一个内核模块保持打开状态 - 您可以使用 lsmod 进行检查。
If the device is
/dev/fb0
, thenlsof /dev/fb0
should list the processes with it open.It might also be held open by another kernel module - you can check that with
lsmod
.您可以使用“lsof”查看哪些进程正在访问特殊文件(例如/dev/fb0 或其他文件)。
但是,这并不能保证适用于所有类型的驱动程序,有些驱动程序具有依赖于它们的内核内容,而这些内容无法通过 /dev/fb0 查看。
You can use "lsof" to see which processes are accessing a special file (e.g. /dev/fb0 or something).
However, this isn't guaranteed to work for all types of driver, some have kernel things which rely on them which aren't viewable with /dev/fb0.