私はFreeBSDの初心者です。 VMにFreeBSD-11.0-RELEASE-amd64をインストールしました。私は、2つの値の合計を計算するための最初の新しいシステムコールを追加したいと思います。 しかし、私の関数にはエラーがあります! mykern.c2つの値の合計を計算するためにFreeBSD-11で新しいシステムコールを追加します。
#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>
struct myargs {
unsigned int k0;
unsigned int k1;
};
int sys_func(struct thread *td, struct myargs *uap);
int sys_func (struct thread *td, struct myargs *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);
}
Errro!
usr/src/sys/kern/mykern.c:17:5: error: conflicting types for 'sys_func' int sys_func(struct thread *td, struct myargs *uap)
/usr/src/sys/sys/sysproto.h:2180:5: note: previous declaration is here int sys_func(struct thread *, struct func_args *);
私はhttps://wiki.freebsd.org/AddingSyscalls
After adding an entry to sys/kern/syscalls.master, you must regenerate the generated files in sys/kern and sys/sys:
$ make -C sys/kern/ sysent
mv -f init_sysent.c init_sysent.c.bak
mv -f syscalls.c syscalls.c.bak
mv -f systrace_args.c systrace_args.c.bak
mv -f ../sys/syscall.h ../sys/syscall.h.bak
mv -f ../sys/syscall.mk ../sys/syscall.mk.bak
mv -f ../sys/sysproto.h ../sys/sysproto.h.bak
sh makesyscalls.sh syscalls.master
から一部を読んで、私はsysproto.hファイルとそれにチェックイン:func_argsは何
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*);
を? 解決策はありますか?
FreeBSD IRCのチャンネルやメーリングリストのサポートが増えるかもしれません。 –