diff --git a/sys/lkm/misc/skel/Makefile b/sys/lkm/misc/skel/Makefile new file mode 100644 index 000000000000..838f8edc076c --- /dev/null +++ b/sys/lkm/misc/skel/Makefile @@ -0,0 +1,8 @@ +# $NetBSD: Makefile,v 1.1 2007/02/04 22:53:09 elad Exp $ + +KMOD= skel + +SRCS= lkminit_skel.c + +.include +.include diff --git a/sys/lkm/misc/skel/lkminit_skel.c b/sys/lkm/misc/skel/lkminit_skel.c new file mode 100644 index 000000000000..245bd5a64097 --- /dev/null +++ b/sys/lkm/misc/skel/lkminit_skel.c @@ -0,0 +1,47 @@ +/* $NetBSD: lkminit_skel.c,v 1.1 2007/02/04 22:53:09 elad Exp $ */ + +/* This code is in the public domain. */ + +#include +__KERNEL_RCSID(0, "$NetBSD: lkminit_skel.c,v 1.1 2007/02/04 22:53:09 elad Exp $"); + +#include +#include + +int skel_lkmentry(struct lkm_table *lkmtp, int, int); +static int skelmod_handle(struct lkm_table *, int); + +/* The module name, as appears in 'modstat' (and used in 'modunload'). */ +MOD_MISC("skelmod"); + +static int +skelmod_handle(struct lkm_table *lkmtp, int cmd) +{ + int error = 0; + + switch(cmd) { + case LKM_E_LOAD: + if(lkmexists(lkmtp)) + return( EEXIST); + + printf("hello world\n"); + + break; + + case LKM_E_UNLOAD: + printf("goodbye world\n"); + break; + + default: + error = EINVAL; + break; + } + + return (error); +} + +int +skel_lkmentry(struct lkm_table *lkmtp, int cmd, int ver) +{ + DISPATCH(lkmtp, cmd, ver, skelmod_handle, skelmod_handle, lkm_nofunc) +}