STREAMS/UX for the HP 9000 Reference Manual

110
How to Compile and Link STREAMS/UX Drivers, Modules, and Applications
Linking STREAMS/UX Drivers and Modules into the Kernel
The definitions of the streams_flags used in the streams_info_t structure are
(see stream.h and conf.h):
STR_IS_DEVICE /* Indicates a driver is being installed */
STR_IS_MODULE /* Indicates a module is being installed */
STR_SYSV4_OPEN /* Indicates SVR4 open is being used, SVR3 open
is default */
MGR_IS_MP /* Module/driver is MP-scalable */
The sync level used in the streams_info_t structure is one of the following
defined in stream.h:
SQLVL_DEFAULT
SQLVL_GLOBAL
SQLVL_ELSEWHERE
SQLVL_MODULE
SQLVL_QUEUEPAIR
SQLVL_QUEUE
For STREAMS drivers, a driver install routine needs to be added to the .c
file for your driver. This function MUST be called xxxx_install, where xxxx
is the driver handle used for your driver. Exactness is needed so that your
driver install routine is correctly called by the I/O subsystem during bootup.
Illustrated below is an example of the driver install routine for the example
tlo driver.
In this tlo example, a major number of -1 was defined in both the tlo_drv
_info and tlo_str_info structure declarations. This invokes the dynamic
major facility. When using this facility, you will need to obtain the system
int
tlo_install()
{
int retval;
if ((retval = install_driver (&tlo_drv_info, &tlo_drv_ops)) !=0)
return (retval);
if ((retval = str_install (&tlo_str_info)) !=0) {
uninstall_driver (&tlo_drv_info);
return (retval);
}
return (0); /* return success */
}