2017-02-12 74 views
2

我是FreeBSD的初学者。我在VM上安装了FreeBSD-11.0-RELEASE-amd64。 我想添加第一个新的系统调用。上周这是my post。 现在我想构建内核。我看到handbook。 但在命令make buildkernel,表示错误!在FreeBSD-11.0-RELEASE-amd64上添加一个新的系统调用

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); 
} 

第一个错误是

/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) 

而在mykern.c我编辑功能内联:

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

而现在一个新的错误:

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

当我输入命令

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

不知道?没有经验? – user7194905

回答

2

系统调用应该开始sys_的名称。 看看/usr/src/sys/kern中的其他文件。

相关问题