STREAMS-UX Programmer's Guide (February 2007)
Modules and Drivers
STREAMS Module
Chapter 4
89
/* Streams data structures for Modules */
int mod_open __((queue_t *, dev_t *, int, int, cred_t *));
int mod_close __((queue_t *, int, cred_t *));
int mod_rput __((queue_t * q, mblk_t *));
int mod_wput __((queue_t * q, mblk_t *));
int mod_rsrv __((queue_t * q));
int mod_wsrv __((queue_t * q));
#define MOD_ID 0
static struct module_info minfo = {
MOD_ID, "MOD", 0, INFPSZ, 65536, 1024
};
static struct qinit mod_rinit = {
mod_rput, mod_rsrv, mod_open, mod_close, NULL, &minfo
};
static struct qinit mod_winit = {
mod_wput, mod_wsrv, NULL, NULL, NULL, &minfo
};
static streams_info_t mod_str_info = {
"MOD", /* Module name */
-1, /* major no */
{ &mod_rinit, &mod_winit, NULL, NULL }, /* streamtab */
STR_IS_MODULE | MGR_IS_MP | STR_SYSV4_OPEN, /* streams flags */
SQLVL_QUEUEPAIR, /* sync level */
"", /* elsewhere sync name */
};
struct streamtab modinfo = {
&mod_rinit,
&mod_winit
};
NOTE Setting module ID to “0” lets STREAMS select a unique module ID dynamically when the
module gets installed on a system. Make sure that the module name is unique.