1

我正在尝试向 freebsd 8 添加一个新的系统调用。我在 VMplayer 上使用 freebsd。当我尝试编译模块时,我给出了这个错误:

在此处输入图像描述

我的代码是(我也有一个 Makefile 文件):

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

};

static char* rot13func(struct thread* td , void* args)
{
    struct user_datas* upp=args;
    char* myarray=(upp->input);
    return myarray;
}

static struct sysent rot13func_sysent={
    1,
    rot13func
};

static int offset=NO_SYSCALL;


static int load (struct module *module , int cmd, void *arg)
{
    int error=0;
    switch(cmd){
       case MOD_LOAD:
          break;
       case MOD_UNLOAD:
          break;
       default:
          error=EOPNOTSUPP;
          break;
    }
    return(error);
}

SYSCALL_MODULE(rot13func, &offset , & rot13func_sysent , load, NULL);
4

1 回答 1

3

看起来您的 Makefile 不正确并且使用了错误的包含路径。尝试使用/usr/share/examples/kld/syscall/module/示例中的一个,如下所示:

# Makefile for building the sample syscall module
# $FreeBSD: src/share/examples/kld/syscall/module/Makefile,v 1.2 2001/09/18 12:03:42 ru Exp $

KMOD=   syscall
SRCS=   syscall.c

.include <bsd.kmod.mk>

它将采取适当的步骤为您设置适当的模块构建环境。

于 2012-11-12T14:49:26.953 回答