Created
April 26, 2013 14:55
-
-
Save masami256/5467898 to your computer and use it in GitHub Desktop.
NetBSDのカーネルモジュールサンプル
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KMOD?= test-mod | |
SRCS= test-mod.c | |
.include <bsd.kmodule.mk> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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