I am trying to add a system under linux-2.6.28+.
I can successfully do this by adding the system call code to the kernel source tree.
But, since it will take a relative long time to compile the kernel,
I would like to put the real work into a loadable linux module.
Therefore, I am trying to do the following tricks:
----------------------------------------
long (*my_call_ptr) (int i) = NULL;
EXPORT_SYMBOL(my_call_ptr);
asmlinkage long sys_mycall(int i)
{
if (my_call_ptr)
return my_call_ptr(i);
else
return -ENOSYS;
}
----------------------------------------
However I get the following warnings:
warning: data definition has no type or storage class
warning: type defaults to ‘int’ in declaration of ‘EXPORT_SYMBOL’
warning: parameter names (without types) in function declaration
Does this mean that EXPORT_SYMBOL will not support pointer kinds of variables.
And anyone have any clues on how to pass the function pointer to a kernel
module so that I can don't have to recompile kernel whenever I make any changes
to my custom system call.
Thanks.
The warnings make it sound
The warnings make it sound as though EXPORT_SYMBOLS has not been declared. Did you include the proper header file?
That is the problem.
Thank you so much for your reply.
The header file solved my problem.
I need to add "linux/module.h" to my source code to make the macro work correctly.
Now, I can get what I want.