- The proc file system provides information on the current status of the Linux kernel and running process.
- It also allows modifications of kernel parameters in simple ways during runtime
- Each process in the system that is currently running is assigned a directory /proc/pid, where pid is the process identification number of the relevant process
- There are also files and directories for process independent information such as loaded modules, used bus systems etc.
Disadvantages of Proc
- There is no interface for the individual files, every user has to find out where and how the information that is required is hidden in the file
- Another disadvantage is that all information is output as strings, therefore conversion is always necessary for further processing
Structure of File system
struct proc_dir_entry
{
unsigned short low_ino; //inode number
unsigned short namelen; //length of the name
const char *name; //name of the entry
mode_t mode; //mode
uid_t uid; //User ID
gid_t gid; //Group ID
unsigned long size; //size of the file
struct inode_operations *proc_iops; //inode-op
struct file_operations *proc_fops; //file-op
struct proc_dir_entry *next, *parent, *subdir; //connection
….
}
The above structure is as PD entry.
- The pointer next, parent, subdir are used for linking. Next shows the next entry in the current directory, parent shows the parent directory (root directory), and subdir shows a subdirectory. This can be implemented like the following loop
for(de=de->subdir ; de; de=de->next){
…..
}
- the file and the directory entries are lying under the /proc/ directory
Excellent work!
ReplyDelete