Connecting Tech Pros Worldwide Help | Site Map

System call error

Newbie
 
Join Date: Jun 2007
Posts: 25
#1: Sep 22 '07
Hey guys. I am trying to implement a system call in linux kernel. I usually use ubutntu, but this I am doing on Fedora. I am using kernel 2.6. Here is what I did:

1. Added a line to arch/i386/kernel/syscall_table.S:

.long sys_foo

2. Added a line to linux/include/asm-i386/unistd.h:

#define __NR_foo 324

also incremented the call count by 1.

3. Added this code to sys.c

[code]
asmlinkage long sys_foo(void)
{
printk("Hello Kernel World");
return THREAD_SIZE;
}
[\code]

4. Wrote this user level client program to test my call:

Code:

#include <unistd.h>
#include <linux/unistd.h>


#define __NR_foo 324
__syscall0(long, foo)

int main()
{

foo();
return 0;
}

However, when I compile the user level program, I get the following error:

success.c:6: error: expected declaration specifiers or ‘...’ before ‘foo’
success.c: In function ‘__syscall0’:
success.c:9: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
success.c:6: error: parameter name omitted
success.c:13: error: expected ‘{’ at end of input

Anybody has any idea?
Newbie
 
Join Date: Dec 2007
Posts: 1
#2: Dec 4 '07

re: System call error


I am stuck with same problem while implementing system call....

somebody please help me out...
Member
 
Join Date: Nov 2007
Posts: 52
#3: Dec 4 '07

re: System call error


Quote:

Originally Posted by juliushemanth

I am stuck with same problem while implementing system call....

somebody please help me out...

It looks like you didn't pay too much attention to makefiles.
Newbie
 
Join Date: Dec 2007
Posts: 1
#4: Dec 22 '07

re: System call error


-I /usr/include/linux/
Reply