Skip to content

Instantly share code, notes, and snippets.

@bdrewery
Created September 18, 2010 22:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bdrewery/586132 to your computer and use it in GitHub Desktop.
Save bdrewery/586132 to your computer and use it in GitHub Desktop.
hello world kmod
#include <sys/param.h>
#include <sys/module.h>
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/conf.h>
static int event_handler(struct module *module, int event, void *arg) {
int e = 0;
switch(event) {
case MOD_LOAD:
uprintf("Hello world\n");
break;
case MOD_SHUTDOWN:
case MOD_UNLOAD:
break;
default:
e = EOPNOTSUPP;
break;
}
return e;
}
DEV_MODULE(hello_world, event_handler, NULL);
KMOD = hello_world
SRCS = hello_world.c
.include <bsd.kmod.mk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment