Click to See Complete Forum and Search --> : new system call problem


ym_monkey
03-24-2002, 09:16 PM
I am trying to implement a new system call. I have made all the necessary entries in both unistd.h and entry.S, and included linkage.h in my local include file, as well as adding _syscallX(.., getval, ..) in the local include file getval.h. However, when I try to invoke the new call from the driver it complains that __NR_getval is undefined in at compile time. The kernel code builds and boots without any errors or warnings. I'm really clueless as to why... Any help would be greatly appreciated.

The system call (actually 2 of them) are very simple. One gets a system global variable,
and the other sets it.

So, the driver has something roughly like this:

#include <getval.h>
#include <setval.h>

int main(){
int variable;

variable = getval();

variable = 5;
setval(5);

variable = getval();
printf("value is: %d\n",variable);
}

Thanks!

bwkaz
03-24-2002, 10:50 PM
Does glibc know about your call?

Perhaps a better question is, does glibc have to know about your call?

Maybe linking dynamically would help, also? I think there's a gcc option for that, probably -dynamic.

Bradmont5
03-25-2002, 02:06 AM
GCC links dynamically by default, doesn't it?

bwkaz
03-25-2002, 08:31 AM
Yeah, maybe it does... *shrug*

Are you using gcc, or g++? If you're using g++ to compile the test program, you'll need to wrap the syscall definition (in your header file) with extern "C" { and }, however I'm not too optimistic on that working.