LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-19-2008, 09:37 AM   #1
linuxdoniv
Member
 
Registered: Mar 2008
Posts: 63

Rep: Reputation: 15
how to read /proc/pid/status in sched.c


Hi,

I was wondering how I could read file like /proc/pid/status in sched.c which can not include user space library routines.

How to manipulate the data in such a file from kernel routines..

Thanks in advance for any input..
 
Old 07-20-2008, 10:05 AM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
I am fairly sure that even if you could access '/proc/pid/status' from kernel space, you could not use that access to manipulate it. It is not an actual file in the sense of occupying disk storage; it is a virtual file whose 'contents' are provided by kernel code.
--- rod.
 
Old 07-21-2008, 02:45 AM   #3
linuxdoniv
Member
 
Registered: Mar 2008
Posts: 63

Original Poster
Rep: Reputation: 15
Hi,

Since I can't use FILE *fp etc to read /proc/pid/status in sched.c, how do I read that file in sched.c .I dont want to write to that file but is reading of that file possible like this. How do I do that.

Thanks in advance.
 
Old 07-21-2008, 09:49 PM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
You might be able to make direct calls to the kernel module functions that implement that virtual file system. Would require some sleuthing to determine exactly what those are...
--- rod.
 
  


Reply



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
uid and gid fileds from /proc/pid/status sanjaykhuntia Linux - Enterprise 2 02-11-2011 01:35 PM
/proc/pid/io seems not to work kornelix Linux - Server 5 06-17-2007 02:39 AM
how to get process status using pid? hongxing Linux - Software 2 04-11-2006 07:11 AM
VmSize : Regarding /proc/<pid>/status shivaligupta Programming 0 04-06-2006 04:33 AM
adsl-status can't read pppoe PID file with rp-pppoe program setup Smarvy Linux - Newbie 2 03-13-2004 11:35 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:55 AM.

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