Полезная информация

next up previous contents
Next: Programming the /proc filesystem Up: The /proc filesystem Previous: /proc Directories and Files

Structure of the /proc filesystem

 

The proc filesystem is rather interesting, because none of the files exist in any real directory structure. Rather, the proper vfs structures are filled in with functions which do gigantic case statements, and in the case of reading a file, get a page, fill it in, and put the result in user memory space.

One of the most interesting parts of the proc filesystem is the way that the individual process directories are implemented. Essentially, every process directory has the inode number of its PID shifted left 16 bits into a 32 bit number greater than 0x0000ffff. Within the process directories, inode numbers are reused, because the upper 16 bits of the inode number have been masked off after choosing the right directory.

Another interesting feature is that unlike in a ``real'' filesystem, where there is one file_operations structure for the whole filesystem, as file lookup is done, different file_operations structures are assigned to the f_ops member of the file structure passed to those functions, dynamically changing which functions will be called for directory lookup and file reading.

[Expand on this section later -- right now it is mostly here to remind me to finish it...]



Converted on:
Mon Apr 1 10:20:16 EST 1996