EXAMPLES
#include <sys/module.h>
#include <sys/conf.h>
static struct cdevsw foo_devsw = { ... };
static dev_t sdev;
static int
foo_load(module_t mod, int cmd, void *arg)
{
int err = 0;
switch (cmd) {
case MOD_LOAD:
sdev = make_dev(&foo_devsw, 0, UID_ROOT, GID_WHEEL, 0600, "foo");
break;/* Success*/
case MOD_UNLOAD:
case MOD_SHUTDOWN:
destroy_dev(sdev);
break;/* Success*/
default:
err = EINVAL;
break;
}
return(err);
}
DEV_MODULE(foo, foo_load, NULL);
SEE ALSO
DECLARE_MODULE(9), destroy_dev(9), make_dev(9), module(9)
AUTHORS