LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 02-12-2006, 04:14 AM   #1
vishalbutte
Member
 
Registered: Dec 2005
Posts: 80

Rep: Reputation: 15
Question /proc


can anybody guide me for topic /proc . how to make entry in /proc file system.
 
Old 02-12-2006, 05:27 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,955

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Basic investigation should start with "man proc".
I suspect you can't do what you want to do.
 
Old 02-12-2006, 01:08 PM   #3
vishalbutte
Member
 
Registered: Dec 2005
Posts: 80

Original Poster
Rep: Reputation: 15
>>I suspect you can't do what you want to do.

well i have in-kernel data structure defined in the kernel code.
which filled with the required information in the boot process.
So after booting i want to see the contents of that data structure.
So how to go around it?
 
Old 02-12-2006, 11:38 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,411

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
Like most things in Unix, it looks like a file, so the usual way is
cat /proc/<your_thing>
 
Old 02-13-2006, 04:28 AM   #5
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
chrism01: I think rather he is asking how to write his data structure to /proc.

vishalbutte: Does this help:
http://www.tldp.org/LDP/lkmpg/2.6/html/x769.html
 
Old 02-13-2006, 12:14 PM   #6
vishalbutte
Member
 
Registered: Dec 2005
Posts: 80

Original Poster
Rep: Reputation: 15
ya mr. bulliver ..u guess my question right...i want to write my own data ....structure in /proc....................
 
Old 02-13-2006, 05:58 PM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,411

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
Quote:
"So after booting i want to see the contents of that data structure.
So how to go around it? "
He also wants to be able to read/check it...
 
Old 02-13-2006, 06:14 PM   #8
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
Quote:
He also wants to be able to read/check it...
Sure, but obviously it must be written to /proc before it can be read. And if he is kernel hacking I think we can safely assume he knows how to cat a file

It is evident English is not his first language, and I read "So after booting i want to see the contents of that data structure." as "I want my data structure to be written to /proc", which he confirmed...
 
Old 02-16-2006, 11:58 AM   #9
vishalbutte
Member
 
Registered: Dec 2005
Posts: 80

Original Poster
Rep: Reputation: 15
can any body send any example or sample program of proc???
plz send any reference program.



thanks in advance

Last edited by vishalbutte; 02-16-2006 at 12:11 PM.
 
Old 02-16-2006, 01:10 PM   #10
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
There is sample code in the link I posted above.
 
Old 02-16-2006, 05:32 PM   #11
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,955

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Perhaps we are all presuming too much.
vishalbutte, is the data strucure yours in the sense that you added code to the kernel to produce this data structure ???.
If so, you must add code to expose it via /proc.

If the structure is part of the current code tree and contains data relevant to your system, but is not currently exposed in /proc that is a different situation.
You might be able to get at it via /proc/kcore.

Edit:... /proc/kmem will be read only of course.
To add a /proc/???? will need kernel space code - i.e. a hack or a module. See bullivers post above.

Last edited by syg00; 02-16-2006 at 07:13 PM.
 
Old 02-24-2006, 01:50 AM   #12
vishalbutte
Member
 
Registered: Dec 2005
Posts: 80

Original Poster
Rep: Reputation: 15
how to read one structure and write that structure in proc file....whatever examples i got in that all operations are performed on buffer , i tried that examples with structure ,but not working...
anybody can help me

thanks in advance!!
 
  


Reply


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
/proc eltn Programming 5 02-16-2006 12:24 PM
Correlation between /proc/devices and /proc/modules ColinLadyka Linux - General 1 02-13-2006 06:25 PM
/proc ? DigiCrime Linux - General 2 04-01-2003 08:58 PM
What /proc proc file do I need? GoboFraggle Programming 1 02-05-2003 12:52 AM
/proc ?? sapilas Linux From Scratch 9 05-18-2002 05:37 PM

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

All times are GMT -5. The time now is 07:52 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration