user7194905
user7194905

Reputation: 217

Add a new system call at FreeBSD-11.0-RELEASE-amd64

I am a beginner in FreeBSD. I installed FreeBSD-11.0-RELEASE-amd64 on VM. I want to add first new system call. And this is my post in last week. Now I want to build kernel. I see handbook. But In command make buildkernel, indicates errors!

mykern.c

#include <sys/sysproto.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/systm.h>
#include <sys/module.h>
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/sysent.h>

#ifndef _SYS_SYSPROTO_H_
  struct myargs {
       unsigned int k0;
       unsigned int k1;
};
#endif

int func (struct thread *td, void *args)
{
     struct myargs *uap;
     uap = (struct myargs *)args;
     printf("Hello");
     return (0);
}

first error was

/usr/src/sys/kern/mykern.c:12:5: error:no previous prototype for function 'func' [-Werror, -Wmissing-prototypes]
int func(struct thread *p, struct myargs *uap)

And in mykern.c I edit function to inline:

inline int func (struct thread *td, void *args)

And now a new error:

init sysent.o:(.data 0xg720): undefined refrence to 'sys_func'

And when I enter command

make init_sysent.c
'init_sysent.c' is up to date

Upvotes: 2

Views: 186

Answers (1)

Roland Smith
Roland Smith

Reputation: 43495

System calls should have a name starting with sys_. Look at the other files in /usr/src/sys/kern.

Upvotes: 2

Related Questions