LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How can I read some kernel variable and print it? (https://www.linuxquestions.org/questions/linux-newbie-8/how-can-i-read-some-kernel-variable-and-print-it-674998/)

awbodbijl 10-08-2008 04:32 AM

How can I read some kernel variable and print it?
 
Hi,
Currenlty I am having a problem where a read operation from an SD card simply hangs. Because of the many read operations, simply adding printk statements to the read function will not work, because it will cause timing problems that run out of hand before the actual problem pops up.
So I thought of having some global variable (say read_status), that is changed to specific value at certain steps while executing the read. Now when the program hangs, simply reading this variable will tell me where exactly the program is. But reading this variable has proven to be very difficult. Can anybody help me out?
tx

estabroo 10-09-2008 09:31 AM

Make a small module that has a read only procfs entry. Set the module up such that reads on the procfs entry return the value of the variable in question.

awbodbijl 10-13-2008 04:52 AM

That's just what I needed!
 
Thanks estabroo for this suggestion!


All times are GMT -5. The time now is 07:27 AM.