仍在使用此係統調用!!!爲什麼我在嘗試執行系統調用時遇到這些語法錯誤
我已經添加了系統調用內核,編譯和操作系統運行。
現在我在編譯我的測試應用程序時出現語法錯誤。
testmycall.h
#include<linux/unistd.h>
#define __NR_mycall 244
_syscall1(long, mycall, int, i)
testmycall.c
#include<stdio.h>
#include "testmycall.h"
int main(int argc, char *argv[])
{
printf("%d\n", mycall(15));
}
這裏是錯誤
[email protected]:~$ gcc -o testmycall testmycall.c
In file included from testmycall.c:3:
testmycall.h:7: error: expected ‘)’ before ‘mycall’
[email protected]:~$ gcc -o testmycall testmycall.c
In file included from testmycall.c:3:
testmycall.h:7: error: expected declaration specifiers or ‘...’ before ‘mycall’
testmycall.h:7: error: expected declaration specifiers or ‘...’ before ‘i’
testmycall.c: In function ‘_syscall1’:
testmycall.c:7: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
testmycall.h:7: error: parameter name omitted
testmycall.h:7: error: parameter name omitted
testmycall.c:11: error: expected ‘{’ at end of input
[email protected]
我已經在系統調用,而不是_syscall1
加入現在我得到這個錯誤
[email protected]:~$ gcc -o testmycall testmycall.c
testmycall.c: In function ‘syscall’:
testmycall.c:7: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
testmycall.c:11: error: expected ‘{’
這是應用程序,任何想法爲什麼?
請發表你得到確切的錯誤。 – DarkDust 2010-10-24 15:18:37
錯誤已添加到信息 – molleman 2010-10-24 15:46:18
嘗試查看預處理的代碼 - 可能會告訴您(和我們)更多關於此問題的信息。使用gcc -E輸出,並注意語法錯誤所在的最後部分。 – 2010-10-24 20:27:37