LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 453|回复: 0

请问一个系统调用的问题

[复制链接]
发表于 2005-4-1 21:00:34 | 显示全部楼层 |阅读模式
我自己在 /kernel/sys.c中编写了一个简单的系统调用函数asmlinkage int sys_my_syscall(int num),按要求我 在/linux/arch/i386/kernel/entry.S中添加了.long SYMBOL_NAME(sys_my_syscall),并且在/linux/include/asm/unistd.h中添加了声明#define _ _NR_my_syscall 259。重新编译了内核。我又编写了一个简单的应用程序test.c来进行调用测试,如下:
#include <linux/unistd.h>
#include <stdio.h>
_syscall1(int,my_syscall,int,num);
main()
{
......
my_syscall(n);
......
}
为什么当我编译test.c(gcc -o test test.c)时,光出错说:
test.c:In function \'my_syscall\'
test.c:3:\'__NR_my_syscall\' undeclared (first use in this function)
test.c:3Each undeclared identifier is reported only once for each function it appears in)
可是我明明在unistd.h中声明了阿?为什么会这样呢?

我linux 核心是 2.4.20
听说2.4版本的系统调用不能这么用了  有这么回事吗,那应该怎么解决?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表