Ok, I've done this in Linux many times but I decided to compile my first Unix module with FreeBSD-7.2 I might be wrong but it looks like the compiler is complaining about code in some of the kernel header files than my code?
Error:
My first clue was when I saw it complain about 'u_int' when my code never used it?
CODE:
Here is the makefile I'm using too:
Error:
Code:
# make
Warning: Object directory not changed from original /home/C-Dubs
cc -O2 -fno-strict-aliasing -pipe -D_KERNEL -DKLD_MODULE -std=c99 -nostdinc -I. -I@ -I@/contrib/altq -finline-limit=8000 --param inline-
unit-growth=100 --param large-function-growth=1000 -fno-common -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-mmx -mno-3dnow
-mno-sse -mno-sse2 -mno-sse3 -ffreestanding -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
-Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -c hello.c
In file included from hello.c:1:
@/sys/module.h:67: error: expected specifier-qualifier-list before 'u_int'
In file included from @/sys/module.h:97,
from hello.c:1:
@/sys/linker_set.h:34:2: error: #error this file needs sys/cdefs.h as a prerequisite
@/sys/linker_set.h:52:2: error: #error this file needs to be ported to your compiler
hello.c:27:2: warning: no newline at end of file
*** Error code 1
My first clue was when I saw it complain about 'u_int' when my code never used it?
CODE:
Code:
#include <sys/module.h>
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/systm.h>
static int
load(struct module *module, int cmd, void *arg)
{
int error = 0;
switch(cmd){
case MOD_LOAD:
uprintf("Hello World!\n");
break;
case MOD_UNLOAD:
uprintf("Good Bye Cruel World!\n");
break;
default:
error = EOPNOTSUPP;
break;
return(error);
}
}
Here is the makefile I'm using too:
Code:
KMOD = hello
SRCS = hello.c
.include <bsd.kmod.mk>