Linux STREAMS (LiS)


Loading LiS

Once you have built LiS you need to load it into memory in order to execute STREAMS drivers. What you do at this point depends upon whether you built LiS as a loadable module or linked it into the kernel.

LiS as Loadable Module

The build process should have copied the file streams.o (streams.ko for a 2.6 system) to the directory /lib/modules/kernel-version/misc. Where kernel-version is something like 2.4.2.

This means that to load LiS you simply type in "modprobe streams". However, the recommended method for starting LiS is to use the streams utility program. streams start loads LiS and streams stop unloads it.

When LiS loads it will print a series of messages showing the names and major device numbers of all STREAMS drivers and pushable modules loaded with it. It will also print some version information about itself, including the version of the kernel for which it has been compiled.

LiS and kerneld

If your kernel has been built using the kerneld construct then LiS will automatically load as soon as any STREAMS file is opened. After installing LiS, simply type in the command streams -s just to test this mechanism. LiS should automatically load, with messages on the console displaying version information and drivers registered. Then the streams command should run and print out a summary of STREAMS activity. You can unload LiS via streams stop.

LiS Compiled into Kernel

If you have compiled LiS into the kernel then you need to make your new kernel executable and reboot your system.

You should always be careful when booting a new kernel. If you have not done so already, you should set up your /etc/lilo.conf file so that you have a trusted backup kernel that you can always boot in case a newly-built kernel crashes at boot time.

From your kernel source tree, copy the file arch/i386/boot/bzImage (or zImage) to the global file that you want to boot from. This is usually either /vmlinuz or /boot/vmlinuz depending upon your distribution of Linux.

Having done that, enter "lilo" to run the lilo utility on your newly copied kernel. You should see some messages from lilo telling you that your new kernel is configured for booting.

Now just reboot your computer.

As the kernel comes up, LiS's initialization routine will be run and it will print out the same driver registration and version information as for the loadable module case, above.

Making /dev Entries

A "normal" LiS build will have made a program named "makenodes" and copied it to /usr/sbin/strmakenodes. Before you can use any of your STREAMS drivers you must run that program. Simply enter "/usr/sbin/strmakenodes" and the program will make all of the STREAMS related entries in the /dev directory.

You do not need to do this every time you rebuild LiS. This only needs to be done if you add "node" entries to the STREAMS Config file or if you do something that would cause the major device numbers of STREAMS files to change.

The "make install" target of LiS runs strmakenodes automatically and is the recommended method of making the /dev entries.

It is now possible for STREAMS drivers to make their own device nodes by calling the routine lis_mknod(). This is useful for loadable STREAMS drivers.