【发布时间】:2017-06-30 09:28:40
【问题描述】:
我是 FreeBSD 的初学者。我在 VM 上安装了 FreeBSD-11.0-RELEASE-amd64。
我想添加第一个新的系统调用。这是上周的my post。
现在我想构建内核。我看到handbook。
但是在命令make buildkernel中,提示错误!
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
【问题讨论】:
-
不知道?没有经验?
标签: kernel system-calls freebsd