linux kernel system call

Discussion in 'C Programming' started by gooch, Oct 6, 2003.

  1. gooch

    gooch Guest

    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
    gooch, Oct 6, 2003
    #1
    1. Advertising

  2. Off Topic: linux kernel system call

    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
    E. Robert Tisdale, Oct 6, 2003
    #2
    1. Advertising

  3. gooch

    Mike Wahler Guest

    Re: [OT, welcome msg, link, redir] linux kernel system call

    "gooch" <> wrote in message
    news:...
    > 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/bchambless0/welcome_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
    Mike Wahler, Oct 6, 2003
    #3
  4. gooch

    bd Guest

    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.
    bd, Oct 6, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. fran
    Replies:
    2
    Views:
    501
  2. yogesh
    Replies:
    3
    Views:
    587
    Kenny McCormack
    Feb 12, 2006
  3. Replies:
    3
    Views:
    169
  4. Ball, Donald A Jr (Library)

    How to debug failing Kernel.system call

    Ball, Donald A Jr (Library), Nov 12, 2007, in forum: Ruby
    Replies:
    3
    Views:
    109
    Alex Shulgin
    Nov 14, 2007
  5. Lars Gierth
    Replies:
    6
    Views:
    221
    David Masover
    Mar 20, 2010
Loading...

Share This Page