
Ha-kit,  which means  "Hacker  Access to  the  Kernel InTernals"  is a
simple patch to  ease probing  the internal  working of  Linux. It  is
meant to be useful for bottom-level hackers, like me, who need a ready
feedback about what  they're doing in the  kernel. This patch provides
only a generic entry point for the C programmer, and is not tailored
to any specific application.

The included patch has been written and used with  a 1.0.0 kernel, but
it applies well to both the 1.0.7 and 1.1.0 sources. I haven't 0.99.xx
sources handy, but I'm pretty sure they will accept the patch.

To patch your kernel you should
	"cd /usr/src/linux/fs" 
and 
	"patch -p < _the_patch_file_".
You can then remove this file, as linux/fs/proc/README.HACKER is
exactly the same.

The description of ha-kit 0.3 follows.

---------
-  WHY  -
---------

   The patch adds a file named "hack" to the /proc filesystem. You can
use /proc/hack  to probe the kernel  internals, to report measurements
and so on.
   The idea is to avoid lenghty printk()s  whenever you are interested
in  some     kernel data.  Printk    loads  the   system  and clubbers
/var/adm/messages. Moreover, its output is difficult to use from other
software. By providing info   in a /proc   file you have  a negligible
effect on system performance, since data is  sprintf()ed only when you
ask for it, and you can retrieve clean information when you need it.

---------
-  HOW  -
---------

   In  order to create a  /proc/hack  in your  filesystem, you need to
#define CONFIG_HACK_PROCFS, by  adding  "-DCONFIG_HACK_PROCFS"  to the
CFLAGS, as defined  in /usr/src/Makefile. The  patch doesn't make this
mod, as I hope Linus will include it in future kernels :-)
   Then, you must provide for data retrivial. I suggest the following
steps:

   -./hack.c
	- Create static variables to hold data.
	- Modify proc_get_hack() to sprintf() your variables.
	- Create a function (e.g. proc_hack_entrypoint())
		which gathers data in the static variables.

   -./hack.h
	- Write typedef's you need and the prototype of
		proc_hack_entrypoint()

   -other kernel sources
	- #include "<relative-path>/hack.h".
	- Call proc_hack_entrypoint() to update data.

   Now you're ready to compile your kernel. You can then retrieve your
info by reading the /proc/hack file whenever you need to.

---------
-  WHO  -
---------

Alessandro Rubini (rubini@ipvvis.unipv.it).
   Feel free to send  me bug reports, fixes, requests  or  flames.  If
there's request, I'll extend the package  to provide a whole directory
of hacker's files, where the user can add and name files at will.

