I am reading the FreeBSD Device Drivers book. The first example is hello.c. But, When I am compiling it, it says
hello.c:
Makefile:
Thanks a lot.
Code:
hello.c:1:10: fatal error: 'sys/param.h' file not found
hello.c:
Code:
#include <sys/param.h>
#include <sys/module.h>
#include <sys/kernel.h>
#include <sys/systm.h>
static int
hello_modevent(module_t mod __unused, int event, void *arg __unused)
{
int error = 0;
switch (event) {
case MOD_LOAD:
uprintf("Hello, world\n");
case MOD_UNLOAD:
uprintf("GoodBye, cruel world");
default:
error = EOPNETSUPP;
}
return (error);
}
static moduledata_t hello_mod = {
"hello",
hello_modevent,
NULL
}
DECLARE_MODULE(hello, hello_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE);
Makefile:
Code:
KMOD= hello
SRCS= hello.c
.include <bsd.kmod.mk>
Thanks a lot.