LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 11-11-2003, 09:33 AM   #1
sleepymish
LQ Newbie
 
Registered: Oct 2003
Posts: 16

Rep: Reputation: 0
Question /proc/bus/pci/devices file question


Hi,

I have a general question on Linux. I believe the "/proc/bus/pci/devices" file in Linux lists all the devices on the PCI bus. I'm wondering if anyone knows how this file is updated or maintained? How is this file updated with the devices.? Is it updated every time the system is turned on or does the system admin update with the appropriate information?

Thanks in advance!

Michelle
 
Old 11-11-2003, 01:11 PM   #2
jbstew32
Member
 
Registered: Feb 2003
Location: Atlanta, GA
Posts: 151

Rep: Reputation: 15
/proc is a fake filesystem, it's really just outputs from the kernel
 
Old 11-11-2003, 01:18 PM   #3
sleepymish
LQ Newbie
 
Registered: Oct 2003
Posts: 16

Original Poster
Rep: Reputation: 0
I'm sorry but I'm not totally understanding it. What do you mean by "fake" filesystem, you mean it's not an actual physical file?
 
Old 11-11-2003, 02:03 PM   #4
dorian33
Member
 
Registered: Jan 2003
Location: Poland, Warsaw
Distribution: LFS, Gentoo
Posts: 591

Rep: Reputation: 32
Well, the /proc idea is following.
Assume that your program uses several variables which values determine or report the program behavior. You want to change the value of this variables or just see these values to see what your program is doing. For that purposes your program is writing these variables to the file (you can see them for report information). Since you need also to control the program by changing a variable values the program has to read the file permanently - at any moment you can edit a variable value, store in the file and your program should read the new value and modify its action.
If you have a lot of the variables in your program it is a sense to use not the only file but to create a directory with a number of files (because of easier access using a tree directory structure)

Linux kernel has a lot of such 'variables' representing current kernel setting, states, etc.
And gives you the way to access them. It creates the directory /proc. This is built up dynamically according to the kernel state. And allows you to write into. This way you can change kernel's 'variable'.

The /proc is fake directory since nothing is written onto the hdd! You see the kernel internals as a regular directory because kernel shows you its internal state in that way.
 
Old 11-11-2003, 02:55 PM   #5
sleepymish
LQ Newbie
 
Registered: Oct 2003
Posts: 16

Original Poster
Rep: Reputation: 0
Thanks!

So basically that means I can't go into the file and modify this variable used by the kernel. Does that imply the kernel updates the /proc/bus/pci/devices automatically each time at bootup?
 
Old 11-11-2003, 04:37 PM   #6
dorian33
Member
 
Registered: Jan 2003
Location: Poland, Warsaw
Distribution: LFS, Gentoo
Posts: 591

Rep: Reputation: 32
Quote:
So basically that means I can't go into the file and modify this variable used by the kernel.
Not true. Some are used just for enabling/disabling kernel function.
For instance: if you are using linux as a router you need to enable packet forwarding. You can do it with the command: 'echo 1 > /proc/sys/net/ipv4/ip_forward' = writing '1' to the file 'ip_forward'

Quote:
Does that imply the kernel updates the /proc/bus/pci/devices automatically each time at bootup?
Not only at bootup. It can be updated it at any moment. In /proc you can see subdirs with 'numerical' names. Each one concerns running process. Pid is the 'numerical' name of the subdir. The subdir exists as long as the process exists.
 
Old 11-12-2003, 10:16 AM   #7
jbstew32
Member
 
Registered: Feb 2003
Location: Atlanta, GA
Posts: 151

Rep: Reputation: 15
yeah there you go, i was just being lazy with my post :-X
 
  


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
where is /proc/bus/usb/devices???? mrchaos Linux - Software 4 12-04-2005 10:26 PM
cannot open /proc/bus/usb/devices, No such file or directory aspartat Linux - Software 2 11-02-2005 12:57 PM
Can't find eof in proc/bus/pci/devices pappsynz Programming 3 04-08-2005 03:26 AM
question on /proc/bus/usb/devices file ryan_a_hH Linux - Hardware 2 01-21-2005 01:49 PM
/proc/bus/usb/devices missing shellcode Linux - General 11 02-24-2004 10:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:07 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
Open Source Consulting | Domain Registration