LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   /proc/bus/pci/devices file question (https://www.linuxquestions.org/questions/linux-newbie-8/proc-bus-pci-devices-file-question-114789/)

sleepymish 11-11-2003 09:33 AM

/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

jbstew32 11-11-2003 01:11 PM

/proc is a fake filesystem, it's really just outputs from the kernel

sleepymish 11-11-2003 01:18 PM

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?

dorian33 11-11-2003 02:03 PM

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.

sleepymish 11-11-2003 02:55 PM

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?

dorian33 11-11-2003 04:37 PM

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.

jbstew32 11-12-2003 10:16 AM

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


All times are GMT -5. The time now is 08:18 PM.