LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Closed Thread
  Search this Thread
Old 07-28-2009, 05:46 AM   #1
HGaurav
LQ Newbie
 
Registered: Jul 2009
Posts: 7

Rep: Reputation: 1
Unhappy 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...
 
Old 07-28-2009, 07:09 AM   #2
chigurh8
Member
 
Registered: Jul 2009
Distribution: Ubuntu, Gentoo
Posts: 102

Rep: Reputation: 18
You're not supposed to double post, and this should be in the Programming forum.

Last edited by chigurh8; 07-28-2009 at 07:10 AM.
 
  


Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
OSE system call functions to Linux Sytem Call functions required roshantraj30 Linux - General 0 06-08-2009 02:06 AM
How to call system call from usb driver's code Mr.J Linux - Kernel 4 09-29-2008 03:47 AM
How can i make centos 4.5's system call using vDSO(call *%gs:0x10) instead of int80 tclwp Red Hat 3 08-06-2007 12:07 AM
How do I include my own system call in file system driver kgp Linux - Kernel 3 06-06-2007 10:41 AM
Calling a system call from a system call? Loc_8 Programming 0 09-16-2006 04:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration