【问题标题】:Conflict error when trying to compile a syscall .c file in freebsd尝试在 freebsd 中编译系统调用 .c 文件时发生冲突错误
【发布时间】:2012-11-09 19:34:39
【问题描述】:

我正在尝试向 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);

【问题讨论】:

  • 来吧,不能剪切和粘贴消息而不是屏幕截图?!

标签: c kernel freebsd bsd


【解决方案1】:

您的 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>

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

【讨论】:

  • 感谢您通过更改我的 make 文件(如您的描述)解决的问题。我想捐赠但 SO 说:“您可以在 20 小时内奖励您的赏金。”。我明天给它。谢谢你
猜你喜欢
  • 2017-11-09
  • 2020-05-16
  • 1970-01-01
  • 1970-01-01
  • 2013-12-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多