By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,289 Members | 3,049 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,289 IT Pros & Developers. It's quick & easy.

linux kernel system call

P: n/a
This is not really a general c question but here goes anyway.

I am trying to add a system call to a kernel (redhat 2.4.18) for a
class I am taking and I have done the following.

in /usr/src/linux/include/asm/unistd.h
I added #define __NR_myfunctionname number

in /usr/src/linux/arch/i386/kernel/entry.S
I added .long SYMBOL_NAME(sys_myfunctionname)

and the next line is .rept NR_syscalls-(.-sys_call_table)/4

I then added to /usr/src/linux/kernel/sys.c

asmlinkage int sys_myfunctionname(int a)
{
return a*a;
}

I also added a symbolic link to /usr/include called asm which links to
/usr/src/linux/include/asm

I wrote a driver with a printf to output the function result and all I
get is
-1. I have tried it without arguments and simply tried to return a
value but that didn't seem to work either. I got instructions on how
to do this from a tutorial and have searched all the groups and the
web with no luck. I would appreciate any help someone might be able to
give.

Thanks
gooch
Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"gooch" <go******@comcast.net> wrote in message
news:d8**************************@posting.google.c om...
This is not really a general c question but here goes anyway.
I can't prevent you from posting off topic but here
goes anyway:

http://www.angelfire.com/ms3/bchambl...me_to_clc.html
I am trying to add a system call to a kernel (redhat 2.4.18) for a
class I am taking and I have done the following. I got instructions on how
to do this from a tutorial and have searched all the groups


I doubt *all*. Have you tried any of the groups listed
at: http://www.linux.org/docs/usenetlinux.html ?

(I located that link in three seconds with Google)

I suspect one or more of the groups enumerated therein
can give answers to your query and much more useful
Linux info.

-Mike
Nov 13 '05 #2

P: n/a
bd
gooch wrote:
This is not really a general c question but here goes anyway.
Then it does not belong in comp.lang.c
I am trying to add a system call to a kernel (redhat 2.4.18)


Try comp.os.linux.development.system
--
Surprise your boss. Get to work on time.

Nov 13 '05 #3

P: n/a
gooch wrote:
This is not really a general c question but here goes anyway.

I am trying to add a system call to a kernel (redhat 2.4.18) for a
class I am taking and I have done the following.

in /usr/src/linux/include/asm/unistd.h
I added #define __NR_myfunctionname number

in /usr/src/linux/arch/i386/kernel/entry.S
I added .long SYMBOL_NAME(sys_myfunctionname)

and the next line is .rept NR_syscalls-(.-sys_call_table)/4

I then added to /usr/src/linux/kernel/sys.c

asmlinkage int sys_myfunctionname(int a) {
return a*a;
}

I also added a symbolic link to /usr/include called asm which links to
/usr/src/linux/include/asm

I wrote a driver with a printf to output the function result and all I
get is
-1. I have tried it without arguments and simply tried to return a
value but that didn't seem to work either. I got instructions on how
to do this from a tutorial and have searched all the groups and the
web with no luck. I would appreciate any help someone might be able to
give.


Try comp.os.linux

Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.