Linux STREAMS (LiS)


Coding STREAMS Applications

This document is concerned with the include files and compilation techniques for STREAMS application programs. It is not intended to be a tutorial on the subject of writing STREAMS applications. Additional resources are available here for reference material.

Header Files

In your STREAMS application program C language source, use the following line to include LiS header files.

#include <sys/stropts.h>

This will include all of the STREAMS related information that you need for a user level program.

If your application program uses the poll system call then you need to include one or the other of the following lines depending upon the kernel version that the application is intended to run on. For kernel versions in the 2.0 group, use the following in order to include the poll.h from LiS.

#include <sys/poll.h>

For kernel versions in the 2.2 group, use the following in order to include poll.h from the kernel's source tree.

#include <linux/poll.h>

Compilation Options

When you compile your STREAMS application, put the following compiler option on the gcc (cc) command line for each C language file that contains any of the above include lines.

-I/usr/src/LiS/include

This directive assumes that you used standard installation procedures for LiS so that the name /usr/src/LiS is a symbolic link to the LiS installation directory.

Linking Options

When you perform the final link of your application using cc or gcc, add the following to the end of your list of files and libraries to be linked. This links in the system call interface routines for LiS.

-lLiS

This library includes the STREAMS based version of the pipe system call. If you want to use the standard STREAMS library routines, such as getmsg and putmsg, but you want to use the standard Linux pipe system call, use the following instead.

-lpLiS

Other STREAMS Resources

Click here for a list of other locations that you can consult for general information concerning writing STREAMS applications.