LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Help in System call (https://www.linuxquestions.org/questions/linux-newbie-8/help-in-system-call-743329/)

HGaurav 07-28-2009 05:17 AM

Help in System call
 
Hi.
I am new to Linux. I just wanted to create a system call. I am using kernel 2.6.28.9. What I did to create a system call is:
1)I created a directory as /usr/src/linux-2.6.28.9/mycall.
2)I created a .c file as /usr/src/linux-2.6.28.9/mycall/mycall.c
SYSTEM_DEFINE1(mycall, int, i)
{
return i+10;
}
3)I created a Makefile file as /usr/src/linux-2.6.28.9/mycall/Makefile
obj-y := mycall.o

4) I edited /usr/src/linux-2.6.28.9/include/linux/syscalls.h
(original file)
asmlinkage long sys_mycall(void);
5) I edited /usr/src/linux-2.6.28.9/usr/include/asm/unistd_32.h
(original file)
#define __NR_mycall 333
6) I edited /usr/src/linux-2.6.28.9/arch/x86/kernel/syscall_table_32.S
(original file)
.long sys_mycall /* 333 */

Now finally when I run the command:
[linux-2.6.28.9]$make M=mycall/
I get the output as :

CC mycall/mycall.o
mycall/mycall.c:3: error: expected ‘)’ before ‘int’
make[1]: *** [mycall/mycall.o] Error 1
make: *** [_module_mycall] Error 2

Where am I wrong?

I tried for the same system call without any argument then on make I got the result as:

CC mycall/mycall.o
mycall/mycall.c:4: warning: return type defaults to ‘int’
mycall/mycall.c:4: warning: function declaration isn’t a prototype
LD mycall/built-in.o
Building modules, stage 2.
MODPOST 0 modules

y is it so?
Is the procedure I adopted, wrong?
Please help me...

pixellany 07-28-2009 09:48 PM

Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.

http://www.linuxquestions.org/questi...d.php?t=743372


All times are GMT -5. The time now is 11:38 AM.