Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Kernel 在FreeBSD-11上添加一个新的系统调用,用于计算两个值之和_Kernel_System Calls_Freebsd - Fatal编程技术网

Kernel 在FreeBSD-11上添加一个新的系统调用,用于计算两个值之和

Kernel 在FreeBSD-11上添加一个新的系统调用,用于计算两个值之和,kernel,system-calls,freebsd,Kernel,System Calls,Freebsd,我是FreeBSD的初学者。我在VM上安装了FreeBSD-11.0-RELEASE-amd64。我想添加第一个新的系统调用,用于计算两个值之和。 但是我的函数有错误! 麦肯 我检查了sysproto.h文件,并在其中: struct func_args { char uap_l_[PADL_(struct myargs *)]; struct myargs * uap; char uap_r_[PADR_(struct myargs *)]; }; sys_func(struct

我是FreeBSD的初学者。我在VM上安装了FreeBSD-11.0-RELEASE-amd64。我想添加第一个新的系统调用,用于计算两个值之和。 但是我的函数有错误! 麦肯

我检查了sysproto.h文件,并在其中:

    struct func_args {
char uap_l_[PADL_(struct myargs *)]; struct myargs * uap; char uap_r_[PADR_(struct myargs *)];
};



sys_func(struct thread *, struct func_args*);
什么是func_args?
有什么解决办法吗?

我编辑了代码,所以没有错误。 我希望它对其他人有用

#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 func_args {
       unsigned int k0;
       unsigned int k1;
};
#endif


int sys_func (struct thread *td, struct func_args *uap)
{
     unsigned int a,b,c;
     a = uap->k0;
     b = uap->k1;
     c = a + b;
     printf("%u + %u = %u\n",a,b,c);
     return (0);
}
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#ifndef\u SYS\u SYSPROTO\u H_
结构函数参数{
无符号整数k0;
无符号整数k1;
};
#恩迪夫
int sys_func(结构线程*td,结构函数参数*uap)
{
无符号整数a,b,c;
a=uap->k0;
b=uap->k1;
c=a+b;
printf(“%u+%u=%u\n”,a、b、c);
返回(0);
}

您可能会在FreeBSD IRC频道或邮件列表上获得更多支持。cmps111?我被困在同一件事上
    struct func_args {
char uap_l_[PADL_(struct myargs *)]; struct myargs * uap; char uap_r_[PADR_(struct myargs *)];
};



sys_func(struct thread *, struct func_args*);
#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 func_args {
       unsigned int k0;
       unsigned int k1;
};
#endif


int sys_func (struct thread *td, struct func_args *uap)
{
     unsigned int a,b,c;
     a = uap->k0;
     b = uap->k1;
     c = a + b;
     printf("%u + %u = %u\n",a,b,c);
     return (0);
}