how make a system call module?

this is my code
Code:
#include <sys/types.h>
#include <sys/param.h>
#include <sys/module.h>
#include <sys/sysent.h>
#include <sys/kernel.h>
#include <sys/systm.h>

static int
hello (struct proc *p, void *arg)
{
  printf ("hello kernel.\n");
  return 0;
}

static struct sysent hello_sysent = {
  0,
  hello
};

static int offset = NO_SYSCALL;

static int
load (struct module *module, int cmd, void *arg)
{
  int error = 0;

  switch (cmd){

  case MOD_LOAD:
    printf ("syscall loaded at %d\n", offset);
    break;

  case MOD_UNLOAD:
    printf ("syscall unloaded from %d\n", offset);
    break;

  default:
    error = EINVAL;
    break;
  }

  return 0;
}


SYSCALL_MODULE (syscall, &offset, &hello_sysent, load, NULL);

and Makefile
Code:
SRCS= hello-1.c
KMOD= helloworld

.include <bsd.kmod.mk>

so seems that have no problem, but when i want compile it give me an error message that say
Code:
'AUE_NULL' undeclared here (not in a function)

what should i do?
 
Back
Top