views:

32

answers:

2

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

+1  A: 

/sbin/lsmod

The third column will be the number of usages.

krico
How do you call userspace program lsmod from kernel code?
Basilevs
You are right, you can't. I misunderstood the question.
krico
+4  A: 

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

Ignacio Vazquez-Abrams
What argument should I provide to get use count of my module? P.S. I'll try THIS_MODULE.
Basilevs