当前位置: 技术问答>linux和unix
跪求:加入系统调用的问题
来源: 互联网 发布时间:2015-09-06
本文导语: 我在sys.c中加入系统调用后,编译内核,测试系统调用时.编译测试程序时显示: /tmp/ccnrZaBf.o(.text+0x23):In function 'mysyscall' undefined reference to 'errno' collect2:ld return 1 exit status 我使用module加入时编译 gcc -Wall -O2 -DMODULE -D...
我在sys.c中加入系统调用后,编译内核,测试系统调用时.编译测试程序时显示:
/tmp/ccnrZaBf.o(.text+0x23):In function 'mysyscall'
undefined reference to 'errno'
collect2:ld return 1 exit status
我使用module加入时编译
gcc -Wall -O2 -DMODULE -D__KERNEL__ -DLINUX -c mysyscall.c -I/usr/src/linux/include
在测试程序中一样发生这样的问题.
在测试测试程序中加入errno.h后编译链接通过,但生成的可执行文件不能运行.即运行后什么都不做就退出了.
感激各位大侠!!
/tmp/ccnrZaBf.o(.text+0x23):In function 'mysyscall'
undefined reference to 'errno'
collect2:ld return 1 exit status
我使用module加入时编译
gcc -Wall -O2 -DMODULE -D__KERNEL__ -DLINUX -c mysyscall.c -I/usr/src/linux/include
在测试程序中一样发生这样的问题.
在测试测试程序中加入errno.h后编译链接通过,但生成的可执行文件不能运行.即运行后什么都不做就退出了.
感激各位大侠!!
|
"errno" is used in User Mode, isn't it ?
Delete it for kernel mode , if possiable.
Another way, define a globe variable, named "errno"
in any header file.
Delete it for kernel mode , if possiable.
Another way, define a globe variable, named "errno"
in any header file.
|
把errorno定义前面的extern去掉几可以了