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

。_饼干妹妹 提交于 2019-12-11 01:19:26

问题


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

回答1:


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



来源:https://stackoverflow.com/questions/42186375/add-a-new-system-call-at-freebsd-11-0-release-amd64

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!