Skip to content

Instantly share code, notes, and snippets.

@masami256
Created April 26, 2013 14:55
Show Gist options
  • Save masami256/5467898 to your computer and use it in GitHub Desktop.
Save masami256/5467898 to your computer and use it in GitHub Desktop.
NetBSDのカーネルモジュールサンプル
KMOD?= test-mod
SRCS= test-mod.c
.include <bsd.kmodule.mk>
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/sched.h>
MODULE(MODULE_CLASS_MISC, test_mod, NULL);
static int
test_mod_modcmd(modcmd_t cmd, void *arg)
{
switch (cmd) {
case MODULE_CMD_INIT:
printf("shcedhz is %d\n", schedhz);
break;
case MODULE_CMD_FINI:
printf("goodbye\n");
break;
case MODULE_CMD_STAT:
break;
default:
printf("unknown param %d\n", cmd);
return ENOTTY;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment