Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-08-2008, 05:32 AM   #1
LQ Newbie
Registered: Oct 2008
Location: Eindhoven, Netherlands
Distribution: Redhat
Posts: 2

Rep: Reputation: 0
How can I read some kernel variable and print it?

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?
Old 10-09-2008, 10:31 AM   #2
Senior Member
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,125
Blog Entries: 2

Rep: Reputation: 124Reputation: 124
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.
Old 10-13-2008, 05:52 AM   #3
LQ Newbie
Registered: Oct 2008
Location: Eindhoven, Netherlands
Distribution: Redhat
Posts: 2

Original Poster
Rep: Reputation: 0
Thumbs up That's just what I needed!

Thanks estabroo for this suggestion!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Not able to print variable value in crontab entry naren_0101bits Programming 6 12-10-2007 01:04 PM
how to print variable value in Makefile? George2 Programming 12 04-27-2006 06:12 AM
Perl wont print my Variable!!! socceroos Programming 10 03-15-2006 06:04 PM
Getting PHP to print variable value on a webpage tangle Programming 9 02-07-2006 03:39 PM
Print a part of variable/string p0tw0r Linux - Newbie 1 04-07-2005 03:49 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:39 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration