Bufflink - fast lightweight kernel/userland communication Bufflink provides a quick and easy way for kernel code to create a ring buffer and write to it from any context (process, bottom half or interrupt). A userland process can access it via a character device which behaves mostly like a FIFO. For more information, see /usr/src/linux/Documentation/bufflink.txt after you have applied the patch below. This distribution contains the following files README This file bufflink-0.3.patch Patch against Linux 2.2.12 kernel bufflink_test.c Kernel module for testing bufflink devtest.c Userland program for testing with bufflink_test To make bufflink available in your kernel: Apply the patch # cd /usr/src/linux # patch -p1 < /foo/bar/bufflink-0.3.patch Configure your kernel # make config (or make menuconfig or make xconfig or ...) Say Y to CONFIG_EXPERIMENTAL Say Y to CONFIG_BUFFLINK_KERNEL Say Y or M to CONFIG_BUFFLINK (If you say M to CONFIG_BUFFLINK then you may want to add the line alias char-dev-120 bufflink to /etc/conf.modules or else you will have to remember to "insmod bufflink" when necessary) Build your kernel and "make modules" and "make modules_install" Reboot on the new kernel To test bufflink: Build the kernel module bufflink_test (in any directory) as follows: cc -Wall -O2 -D__KERNEL__ -DMODULE -c bufflink_test.c then insmod it: # insmod ./bufflink_test.o and look at the kernel log (wherever you have printk appearing) to see what minor it has picked (almost certainly 0). Ensure there is a device node with the right major/minor: # mknod /dev/bufflink0 c 120 0 (replacing the 0 with whatever minor bufflink_test logged and replacing 120 with whatever major appears against "bufflink" when you do "cat /proc/devices"). Compile the userland side: cc -o devtest devtest.c You can then write to the ring buffer: ./devtest w 8 ./devtest w 8 (will write 16 bytes in two lots of 8). ./devtest r 2 will read and print the first 2 immediately. ./devtest r 40 will read and print the remaining 14 *immediately* (i.e. it will not block waiting for the full 40). ./devtest r 40 will block waiting for more data in the ring buffer. Leave it in the background or another window, then do ./devtest w 10 to write 10 bytes to the ring buffer. That wakes up the reader immediately so that it sees the 10 bytes. Play with devtest to convince yourself of the behaviour when an overflow occurs.