System call problem
Hi,
I am implemeting a new system call for a project I'm working on. I added the system call to the file arch/i386/kernel/process.c and added the relevant entries in the files arch/i386/entry.S and include/asm-i386/unistd.h. My system call is made up of only two lines, a printk statement, and a return statement which gets the value of a field that I added to the task_struct structure.
I compiled and booted the kernel and am trying to build a user space application that uses my system call, however gcc is returning this error:
/tmp/cc4zgzUr.o(.text+0x4e): In functiono `get_rmt_paging':
: undefined reference to `errno'
Can anyone help me with this?
Thanks
Josef
Quoted 5 lines · Josef E. Galea
I compiled and booted the kernel and am trying to build a user space application that uses my system call, however gcc is returning this error:
/tmp/cc4zgzUr.o(.text+0x4e): In functiono `get_rmt_paging':
: undefined reference to `errno'
Where you defined your system call in the user space program (ie. where you declared your _syscall macro), did you also include <errno.h>?
-- Steve
Quoted 11 lines · Steven Rostedt
Quoted 6 lines · Josef E. Galea
I compiled and booted the kernel and am trying to build a user space application that uses my system call, however gcc is returning this error:
/tmp/cc4zgzUr.o(.text+0x4e): In functiono `get_rmt_paging':
: undefined reference to `errno'
Quoted 8 lines
Where you defined your system call in the user space program (ie. where you declared your
_syscallmacro), did you also include <errno.h>?-- Steve
I included <linux/errno.h> and it didn't solve the problem. Now i included <errno.h> and it did. Thanks for you help!
Josef
Quoted 4 lines · Josef E. Galea
Hi,
I am implemeting a new system call for a project I'm working on. I added the system call to the file
arch/i386/kernel/process.cand added the relevant entries in the filesarch/i386/entry.Sandinclude/asm-i386/unistd.h. My system call is made up of only two lines, a printk statement, and a return statement which gets the value of a field that I added to thetask_structstructure.
Quoted 8 lines
I compiled and booted the kernel and am trying to build a user space application that uses my system call, however gcc is returning this error:
/tmp/cc4zgzUr.o(.text+0x4e): In functiono `get_rmt_paging':
: undefined reference to `errno'Can anyone help me with this?
Thanks
Josef
You can't use kernel headers in user-mode functions. For one thing, they bring in undefined stuff.
Your user mode code can, of course get the definition of errno by #include <errno.h>. That's the errno that exists in every user- mode 'C' program-developed process space. However, if get_rmt_paging is not one of your functions, you are in trouble by mixing up user-mode and kernel-mode headers.
Normally, the return value of a kernel function is checked and if it's negative, the positive equivalent is put into the global variable errno and then the return value is changed to -1. This is where the user-mode reference to errno occurs.
Cheers,
Dick Johnson
Penguin : Linux version 2.6.10 on an i686 machine (5537.79 BogoMips).
Notice : All mail here is now cached for review by Dictator Bush.
98.36% of all statistics are fiction.