Find the answer to your Linux question:
Results 1 to 2 of 2
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 ...
  1. #1
    Just Joined!
    Join Date
    Jul 2009
    Posts
    3

    Exclamation error: expected ‘)’ before ‘int’

    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...

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Please move this to the Linux Kernel forum since you are trying to write a kernel module with related system call API.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...