LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-19-2004, 06:16 PM   #1
drumlix18
LQ Newbie
 
Registered: Oct 2004
Posts: 8

Rep: Reputation: 0
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
 
Old 10-19-2004, 06:27 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,275

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
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?
 
Old 10-19-2004, 06:33 PM   #3
drumlix18
LQ Newbie
 
Registered: Oct 2004
Posts: 8

Original Poster
Rep: Reputation: 0
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!
 
Old 10-19-2004, 08:11 PM   #4
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,275

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
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.
 
Old 10-19-2004, 08:14 PM   #5
drumlix18
LQ Newbie
 
Registered: Oct 2004
Posts: 8

Original Poster
Rep: Reputation: 0
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
using system call ej25 Programming 9 11-30-2004 12:45 PM
new system call soul2 Linux - General 1 11-03-2004 03:41 PM
Is it possible to use system() and get the return value from the system call newguy21 Programming 1 08-11-2004 02:37 PM
System call dami Linux - General 0 11-18-2003 12:18 PM
about system call alchen1999 Programming 10 09-01-2003 04:43 AM


All times are GMT -5. The time now is 11:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration