Re: /proc files

Lenart Gabor (lgb@hal2000.hal.vein.hu)
Thu, 5 Nov 1998 19:21:24 +0100


On Fri, Oct 30, 1998 at 04:34:26AM -0800, Clayton Weaver wrote:
[...cut...]
> <cached>5678903</cached>
> <stotal>4476231</stotal>
> <sfree>4736291</sfree>
> </xml>
>
> Looks kind of brutal compared to the nice, clean, /proc/meminfo
> file, doesn't it? But automated tools can parse this just fine,
> regardless of whether some admin tool things "SwapFree" should
> be spelled "SwapFree", "swapfree", "SWAPFREE", or in some other

I think text files in /proc were designed to be (easy) human readable.
Programs should use sysctl()-s, binary /proc files or simething similars
which are MUCH better for them mainly in performance and in their smaller
code size (avoiding XML parsers)

IMHO, text files in /proc are usefull for eg. quick system checkings using
simple shell commands or for small shell scripts, but programs should use
a much better and faster method. The Linux kernel has got lots of things
which can be moved into user space since kernel should contain only
badly needed functions. Others can be implemented in libc or something
similar (there is a project - I can't remember its name - which reduced
the kernel and moved lots of functions into user space, and the system's
performance were much better than with the official Linux kernel. This
is because it tooks too much time to switch between user and kernel
iopl. This remark is not too /proc related but it's interesing, isn't it :).

My knowledge in Linux is very limited however I was a member of an OS
developmenting and I'm an x86 assembly guy. I've been using Linux for ages
but I've got my school, my girlfriend and my work to try to earn some money,
so I've got no sparetime to learning kernel-hacking though this topic
is very-very interesting for me !

But ... So. Using binary mmap()-able /proc files in kernel space would be
better. Text files in /proc in some way can be implemented via a lib
(with some kernel support of course), or it would be good to move /proc
text files handler into a kernel module. Since unsing text /proc files
should be avoided by programs and only preferable by humans etc, a kernel
module will be a GREAT solution ! In this case your XML parser idea can
be implemented too, since the module can be unloaded after using this
feature so it would be a memory-saver-solution even if you want to implement
a method to "full duplex" XML gateway in /proc beetween kernel and user
space processes. Another good thing : exchange this module can be usefull to
change /proc filesystem structure without rebooting your computer with
nice uptime :)

Of course having this module allow us to easily modify /proc structure
in the future if it's needed.
> A little tougher for floats, negative numbers, etc. It's just user-space
> overhead, though, so I don't really see why an all character-encoded /proc
> is a point of contention.
>
> Just an idea. If it is not an improvement, it won't get implemented.

The "XML based /proc files" is an interesting idea. But how about files
which can be rewritten to the /proc ? In this case kernel would have got
an XML parser. It sounds very-very-...-very ugly. Sometimes it can be
compared with Windows' activedesktop (uh!).
(OK, this was my first remark written here first before I writing
the other parts of my answer :)

Sorry for my bad English and I hope my idea is interesting too :-)

Bye : Gábor Lénárt

---[ LGB/DC ]------------------[ root@hal2000 ]-----------------[ LINUX ]---
"The truth is out there" "We're living together" "The future is dark."
---[ 88/422022-4602 ]--[ http://www.hal.vein.hu/~lgb ]------[ 87/477074 ]---

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/