Go to main content

STREAMS Programming Guide

Exit Print View

Updated: November 2020
 
 

STREAMS Module Configuration

The following example shows the structures you need if you are working with a module instead of a driver. modlstrmod is used in modlinkage, and fmodsw points to streamtab instead of using dev_ops.

Example 57  Module Structures
extern struct streamtab pteminfo;

static struct fmodsw fsw = {
		"ptem",
		&pteminfo,
		D_NEW | D_MP
};

/*
 * Module linkage information for the kernel.
 */
extern struct mod_ops mod_strmodops;

static struct modlstrmod modlstrmod = {
		&mod_strmodops,
		"pty hardware emulator",
		&fsw
};

static struct modlinkage modlinkage = {
		MODREV_1, 
		(void *)&modlstrmod,
		NULL
};

For more information, see the modlstrmod(9S), modlinkage(9S), fmodsw(9S), streamtab(9S), and dev_ops(9S) man pages.