Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get use count from Linux kernel module?

I have a problem with use count of kernel module being developed.I'd like to print it for debugging purpose. How can I obtain it from the module code?

Kernel version in question - Linux 2.6.32

like image 470
Basilevs Avatar asked Jul 20 '10 08:07

Basilevs


People also ask

How do I see what is using my kernel module?

You can try lsmod | grep <module name> to see all loaded kernel modules that are using a module. You can also try dmesg | grep <module name> to see if the kernel logs have any clues as to which processes may be using a module. You may be able to remove the module using rmmod --force <module_name> .

How do I get list of kernel modules loaded in memory?

Under Linux use the file /proc/modules shows what kernel modules (drivers) are currently loaded into memory.

What is using kernel module?

Kernel modules are pieces of code that can be loaded and unloaded into the kernel upon demand. They extend the functionality of the kernel without the need to reboot the system. A module can be configured as built-in or loadable.


1 Answers

module_refcount() will give you the use count of the module passed.

like image 93
Ignacio Vazquez-Abrams Avatar answered Oct 20 '22 16:10

Ignacio Vazquez-Abrams