【问题标题】:Add a new system call at FreeBSD-11.0-RELEASE-amd64在 FreeBSD-11.0-RELEASE-amd64 添加一个新的系统调用
【发布时间】: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


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2017-06-22
    • 2016-06-02
    • 2016-05-31
    • 1970-01-01
    • 2017-07-03
    • 1970-01-01
    • 1970-01-01
    • 2011-12-18
    • 2011-04-23
    相关资源
    最近更新 更多