Home

Charles Luciano

This project is only of value if you are working in the Linux kernel and are interested in creating entries in the /proc file system.

It allows you to define a hierarchy of directories and files in /proc in a table. It further allows you to delete the entire hierarchy with a single function call.

In addition to that, there are callbacks that you can specify for any directory or file in the hierarchy so that you may later attach other hierarchies to them.

This code compiles into a demo module that can be insmod'd into your kernel. It creates a simple tree in under /proc/0_test. under that directory is /proc/0_test/command where you can 'echo devname > /proc/0_test/command/add_device'. When you do this, a new hierarchy is created under /proc/0_test/devices/devname which currently contains only one entry which is status. You can delete the sub-hierarchy by 'echo devname > /proc/0_test/command/rm_device'

There's little error checking. If you add the same devname twice all bets are off. This is little more than a demostration of the code in proc_utils.h and proc_utils.c.

proc_utils_test_ents.c shows you how do describe the hierarchy.

proc_utils_test_funcs contains the read/write methods for the /proc files.

proc_utils_test_module.c is a wrapper to load and initialize the demo.

More documentation and a more elaborate demo will follow one of these days.

UPDATE:

I have written some debug utilities and they use /proc entries for controlling and retrieving the messages. They are a useful example for the use of the /proc utilities.

Here is a good place to start:
https://sourceforge.net/p/procdbgunittest/home/Home/

Project Admins:


MongoDB Logo MongoDB