Managing and Developing Dynamically Loadable Kernel Modules

Managing and Developing Dynamically Loadable Kernel Modules
Developing Dynamically Loadable Kernel Modules
Chapter 12564
return (0);
}
/*
* UNLOAD
*/
static int
dlclass_unload(void *drv_infop)
{
/* This function is only called when the administrator
* attempts to unload the module and there are no open
* devices using the module. If there is some reason that
* the module should not be unloaded, check it now and
* return non-zero.
*/
if (dlclass_no_unload) {
printf("dlclass> I’m BUSY\n");
return (EBUSY);
}
/* Unregister with WSIO */
if ( wsio_uninstall_driver(&dlclass_wsio_info) ) {
/* Uninstall failed! Return to a loaded,
* functional state. */
printf("dlclass> wsio_uninstall_driver failed!!\n");
return (ENXIO);
}
/* Cancel pending timeouts, free allocated memory and
* resources, etc.
*/
if (dlclass_debug)
printf("dlclass> Unloaded\n");
return (0);
}
/*
* INSTALL
* This function is called if module is statically linked.
*/
int
dlclass_install(void)
{