proc filesystem
can any one tell me : how can a programmer use the proc filesystem's information ? kindly give me some examples !!
|
What do you want to do?
/proc contains "virtual files" which are simply ways of viewing the various kernel data structures. The generic answer to your question is "read the file of interest and extract the desired data.". |
thanks a lot for your valuable answer !
|
Have any one of you tried anything with the proc file system ? If so, kindly share your experiences !
thanks ! |
Here's a classic example
echo 1 > /proc/sys/net/ipv4/ip_forward http://www.togaware.com/linux/surviv...orwarding.html |
Quote:
|
Actually, I am trying to find out what can be done to os using the valuable information contained in the proc file system !! Currently I am finding ways to play with the linux operating system ! Thats why i asked if you have done something w.r.t proc file system !
thanks ! |
Quote:
Google: /proc filesystem |
Quote:
Here you go..... Q: What can I do with the /proc filesystem? A-1: By reading from the various data structures in /proc you can directly access just about everything the kernel is doing. A-2: By writing to these same structures, you can change what the kernel is doing without "going through channels". In some cases, this will enable clever tricks and in other cases, it may total destroy your system. |
@pixellany,
thanks for your reply, i did understand what u said, but can u give me at least 2 specific examples in which one achieves something my modifying/reading proc file systems ! thanks! |
"/proc" is one of the cleverest inventions I have seen in a very long time.
Historically, it has always been a huge problem to either "peek behind the curtains of the operating-system" or (heaven forbid!) to (legitimately...) "change something." "/proc" is a brilliantly elegant solution. The operating-system gives you the perfect illusion that "all sorts of system data" is available as a collection of read/write files. (You may or may not have permission to read and/or to write them, of course...) Any ol' "perfectly ordinary, nothin' special, non-privileged" program can easily work with that. None of these files "actually exist, anywhere." The entire directory and all of its contents are purely a figment of the operating system's imagination. |
Quote:
Code:
$ find /proc | while read path Google: /proc filesystem Just like a mortal human being intent on learning things the usual way. |
All times are GMT -5. The time now is 03:21 PM. |