1
我已经添加了一个hello world系统调用到Linux内核3.16,然后我编译并运行它。我通过syscall
函数调用了我的系统调用,但它没有打印任何东西,并且syscall
函数的输出不是-1。我怎样才能找到我的系统调用被添加到内核?
这是我的系统调用代码:
#include <linux/kernel.h>
asmlinkage long sys_hello(void){
printk("hello world\n");
return 0;
}
,这我的C程序代码来调用我的系统调用:
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>
#include <string.h>
#include <errno.h>
int main(void){
printf("function\n");
if(syscall(317)==-1){
printf("no\n");
}
else{
printf("yes\n");
}
return 0;
}
C程序的输出是:
function
yes
我怎样才能找到我的系统调用正确添加到内核?
您是否尝试过使用strace等工具调试执行? –
我不知道dmesg。它试图dmesg和它的工作 – hamid