Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The sleep_modevent function is the module event handler for Example 5-1. Here is its function definition (again):
static int
sleep_modevent(module_t mod __unused, int event, void *arg)
{
int error = 0;
switch (event) {
case MOD_LOAD:
error =
load(arg);
break;
case MOD_UNLOAD:
error =
unload(arg);
break;
default:
error = EOPNOTSUPP;
break;
}
return (error);
}
On module load, this function simply calls the load function. On module unload, it calls the
unload function.