Penguin Programming - Source Code


Example/Skeleton Source Code (kernel/driver level)

Warning:
This is low-level source code that is intended as examples or skeletons (these aren't demos).
If you want to use the code, you should extend or integrate it yourself.
Don't blindly compile the sources and try running the code!!!

Skeleton/makefiles of char device driver for kernel 2.4 & kernel 2.6:

Download chrdev_skeleton.tar.gz
MD5: b83187ff976bbf188c6eb3f6e45d6651  chrdev_skeleton.tar.gz

Program that directly reads blocks from a disk partition:

Download diskread.tar.gz
MD5: 4f23275f4260c4180381405b3d28dfa8  diskread.tar.gz

This could be developed into a bad block tester.

"Hello, world!" from the kernel 2.4 /proc interface:

Download proc_hello.tar.gz
MD5: 4322cae17c3368b949bea3f7cd361e9c  proc_hello.tar.gz

For example:


$ insmod proc_hello.o
$ cat /proc/hello
Hello, world!

/proc/echo kernel 2.4 module:

Download proc_echo.tar.gz
MD5: 6344dd78874c48b835b78520fc621258  proc_echo.tar.gz

Can be used as a skeleton for a read/write /proc file.


Linux Network Code

C code to discover network interfaces and IP addresses:

Although a more portable alternative is to use ioctl(SIOCGIFCONF).

discover_iface_ipadr.c [by Michael Heiming] original Usenet posting

MD5: 1f1954b088fc1ab84f729ab9c788871e  discover_iface_ipadr.c

index   home