1
私はFreeBSDモジュールを拡張しています。私が書いた(KLDを使用して)2つのシステムコール関数を呼び出す必要があります。私はシステムコール関数自体が正常に動作していることを知っています。なぜなら、それらを呼び出して正しい値を返してくれる別のテストプログラムがあるからです。FreeBSD SysCall in C - 暗黙の関数 'modfind'の宣言
はしかし、私は実際のプログラムにそのテストプログラムの適切な部分をプラグインしようとしたとき、私は
vnode.c: In function 'getSyscall':
vnode.c:1014: warning: implicit declaration of function 'modfind'
vnode.c:1022: warning: implicit declaration of function 'modstat'
*** Error code 1
を取得し、私は本物に(作業)テストプログラムを含んでいるのすべてを持っています、私はなぜmodfindとmodstat関数を見つけることができないのか分かりません。
#include <stdio.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/module.h>
#include <unistd.h>
#include <errno.h>
#include <sys/param.h>
// Lots of other unrelated functions here
/*
*
* returns a syscall number or -1 for error
*/
int getSyscall
(char *str)
{
struct module_stat stat;
int modid;
int syscallnum;
modid = modfind(str);
if (modid == -1)
{
perror("modfind: ");
return -1;
}
stat.version = sizeof(stat);
if (modstat(modid, &stat) == -1)
{
perror("modstat: ");
return -1;
}
syscallnum = stat.data.intval;
return syscallnum;
}
どのようなFreeBSDのバージョンをお使いですか?私はあなたのコードを9-STABLEでコンパイルしましたが、警告はありません。 – arrowd