On Fri, 5 May 2000, Michal Kosek wrote:
> I want to learn something about using of /dev/kmem.
The idea of /dev/kmem is that file "offsets" in it correspond to kernel
virtual addresses, so seeking to the addresses of "well-known" symbols and
reading values off there gives you the values of kernel data
structures. Of course, these values are not 100% self-consistent because
the kernel data structures change while you are reading/writing them.
Linux version of /dev/kmem has one limitation - you cannot write to
vmalloc'd range of addresses but you can read from them. Amit Kale (of
VERITAS) solved this problem and sent a patch so if you need this ability
- look for it in archives.
As for examples of usage of /dev/kmem - some old (and also non-Linux)
versions of ps(1) used to use /dev/kmem - nowadays it is much better to
access kernel data structures via well-defined interfaces exported by
/proc.
Also, kernel programmers sometimes write little programs that
automatically test self-consistency of various kernel structures by
reading /dev/kmem.
The best example of usage of /dev/kmem is probably crash(1M) which is
available on all System V Release 4 UNIX flavours. (there is also a clone
of crash for Linux from MCL)
Regards,
Tigran
-
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/
This archive was generated by hypermail 2b29 : Sun May 07 2000 - 21:00:17 EST