Managing and Developing Dynamically Loadable Kernel Modules
Managing and Developing Dynamically Loadable Kernel Modules
Developing Dynamically Loadable Kernel Modules
Chapter 12550
Example 12-11 STREAMS Module _load and _install Functions
static streams_info_t str_info = { ... };
int
module_name
_load(void *arg)
{
int retval;
if (
module_name
_install())
return ENXIO;
return 0;
}
int
module_name
_install(void)
{
/* Install in Streams */
if ((retval = str_install(&str_info)) != 0)
return retval;
return 0;
}
The system automatically tracks pushes and pops of a STREAMS
module on active streams; a module cannot be unloaded while it is
pushed onto one or more streams. A typical unload() function for a
STREAMS module is as follows:
Example 12-12 STREAMS Module _unload Function
int
module_name
_unload(void *arg)
{
int retval;
/* Uninstall from Streams */
if ((retval = str_uninstall(&str_info)) != 0)
return retval;
/* Free module specific resources, etc. */
...
return 0;
}