help creating a system call
ok, im creating a system call function called getThreadInfo, which basically outputs the max and current running threads. i have the function set up in funcThreadInfo.c and h.
i have a driver.c program that should call the function. my biggest confusion (im very new to kernel's) is how to get up the makefiles. i keep my funcThreadInfo.c function in the kernel directory. i edited the one in my /usr/src/linux-2.4/kernel/ one to have the funcThreadInfo.o file onto it (again, i wasnt sure exactly which list to append it onto), and i added the same .o file into the makefile in folder /usr/src/linux-2.4/ (the big one). my other confusion is, they have us set up a link in the /usr/include directory to point to the include/asm-i386 folder (where i keep my funcThreadInfo.h file). is this user/include folder where the driver program goes for the user (aside from root user)? my files are like this... /usr/include/driver.c /usr/src/linux-2.4/kernel/funcThreadInfo.c (with makefile) /usr/src/linux-2.4/include/asm-i386/funcThreadInfo.h (with makefile) im also confused on how to recomiple the kernel using this. im just totally confused . any help is appreciated |
Once you've added the object file to the Makefile, you can rebuild the kernel and it should just build right in. Also, since you're writing a syscall, you'll need to add it to the syscall table in arch/i386/entry.S (assuming you're on x86 and haven't done so). The /usr/include directory is for header files, not userland programs -- they go into the normal bin or lib directory (depending on whether you have an executable or library). Also, are you sure there's no existent function that does this?
|
where would i put the driver.c file then? they told us we have to log on as a normal user in order to use the system call through driver.c. i forgot to mention i have a driver.h file in usr/include/. i where should the .c file go for the normal user to run?
as for the kernel makefile. i added the funcThreadInfo.o object file (this is the system call function) at the end of "export-objs", is this correct? or should it be under obj-y or O_TARGET's lists of .o files? thanks! |
The location of the driver.c file doesn't matter to the kernel. After all, it's the user space functionality -- the kernel doesn't care about it. As for where to put the .o -- I think either will work, but the exported objects will be accessible from modules. I'm really not sure, though, as the only time I did this was with 2.6 which handles things somewhat differently.
|
ok thanx,
would u happen to know why i get the error "errno undeclared" whem im doing make bzImage? i included the errno.h files but its still there. |
All times are GMT -5. The time now is 03:34 PM. |