xmlprocfs SourceForge Logo

Latest Update Date: Mar 5 2001
(GB Chinese Version)
(Big5 Chinese Version)
4.What have done
6.Headache Difficulties
7.Why I decide to create a new file system
8.Output Examples

Any comments about xmlprocfs are welcomed, please mail them to Charles Wang

Hello everybody who are interested in xmlprocfs!

xmlprocfs is a patch of linux kernel to new file system which is corresponding to traditional procfs. It is licensed by General Public License (GPL). Everybody knowns that the linux kernel reports a great deal of important information through procfs to the applications in user-mode, and an application can write some files in procfs to controll kernel in some aspects too.

The output of procfs is human-readable but don't follow any public rules, so the programmer has to compose parsers for each different files in procfs. This task is so tired that I thought if procfs can report data in XML format, so I can use general XML parser to fetch data from procfs. But there are a great many existing application need the traditional output of procfs, there will failed if I change the output of procfs directly.

So I create a new file system xmlprocfs, all files in procfs will present in the same positions in xmlprocfs, they report same data but in different format. I can get XML data from xmlprocfs and the only change is the root path. procfs and xmlprocfs are independent from the view of user, he or she can mount/umount any of them without interfering the other.

  • xmlprocfs-0.3 released in Mar 5 2001. This version should be applied to linux-2.4.2. It formalize the most of output functions. It fixes some bugs in 0.2 also. I noticed the complexity of output functions in development. Different output functions generate output in different mananer: somebody use sprintf directly, somebody generate content when the file is opened, somebody change the meaning of file pointer so the output can be generated rapidly. And many subsystem of kernel provided some method to support files in proc file system. Single formal output method isn't enough obviously, some output functions can't be formalized in the current formal manner. And some other output functions will be slow down after formalized. So the mask task of the next version is to develop new formal output method.
  • I'm busy in recent days, and something confuses my thought...., but the work of xmlprocfs is still going on. I found the proc output functions spread all over the source of kernel when I modify these output functions, the amount of work go beyond my first imaginiation. So I decide to divide the whole work into small piece. Firstly, I want to formalize all output functions, it is to let 'proc_printf' to accomplish most of the output work. This work will setup a better base for the next phase of work. But this work will cost a great deal of time too. So I provide the list of source modification. Only the English version of the list will be provided because it will be changed everyday. See 4.What have done for details.
  • xmlprocfs-0.2 released in Feb 5 2001. It fixes a bug in 0.1, some more files in xmlprocfs can generate XML report(For detail, see What have done). A function which do XML escape (from '&' to '&amp;', from '<' to '&lt;', from '>' to '&gt;') has been provided.
What have done

Single formal output method isn't enough now. Many output functions generate their output in different way, they will be impossible or be slow down if formalize them by the current method. The main task of the next version will be develop new formal output method. Most of the output functions which suitable for the current formal method have been formalized, but they still can't generate XML data. Technical problem will be described in 'linux/Documentation/filesystem/xmlprocfs.txt'.

The list of source code modification provide the modification in each directory of kernel source in detail.

The following tables enumerate all files which already can generate XML data with the assumption that the mount point of xmlprocfs is /xmlproc. The version number in parenthesis indicates the first version which let it can generate XML data.

The files in /xmlproc
cmdline (0.1)cpuinfo (0.1)devices (0.1)dma (0.1)
execdomains (0.1)filesystems (0.1)interrupts (0.1)iomem (0.1)
ksyms (0.1)loadavg (0.1)locks (0.1)meminfo (0.1)
modules (0.1)partitions (0.1)stat (0.1)swap (0.1)
uptime (0.1)version (0.1)
The files in /xmlproc/pid
cmdline (0.2)environ (0.2)stat (0.2)statm (0.2)
status (0.2)
The files in /xmlproc/tty
drivers (0.2)ldiscs (0.2)

Say 'yes' for 'xmlprocfs' in running 'make config', 'make menuconfig' or 'make xconfig'. After a kernel with the support of xmlprocfs has been compiled and setup successfully, you can use 'mount -t xmlproc nodev /xmlproc' to mount the file system and try it.


    The reading of the following files will cause system crash in xmlprocfs-0.1:

    • /xmlprocfs/net/raw
    • /xmlprocfs/net/netstat
    • /xmlprocfs/net/snmp
    • /xmlprocfs/net/sockstat
    • /xmlprocfs/net/tcp
    • /xmlprocfs/net/udp

    It has been fixed in xmlprocfs-0.2.

Headache Difficulties

    The read function for /xmlproc/pid/cmldine will output environment variable too when the argument isn't termiated by 0. And the comment tell me that this is caused by 'setproctitle(3)'. I don't known why and can't find the specified man page, so I do nothing about it now.

    Help me please if you can. THANK YOU!

Why I decide to create a new file system

There is another way to let application got XML data: compose a library to read traditional data from procfs, and create data structure in memory as if the XML parser do. But

  • The library is implemented by a specific programming language, such as C. It can't be used by any other programming language without wrapper.
  • The library can generate one type of data structure only, but different XML library accept different XML data structure (for example, libxml and xml4c generate totally different XML data structure). So the generated data structure can be accessed and operated by only one specific XML library.
  • The linux kernel is improved rapidly without any pause, it is very difficult to catch up these change because the library is totally independent with kernel.

For the new file system xmlprocfs, the application programmer can:

  • Use any programming language without any difficulty.
  • Use any XML parser without any difficulty.
  • Kernel developer can generate data in two format without any difficulty, and the maintainer of xmlprocfs can do this work without any difficulty too.
Output Examples