Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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?
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.