[3117] in linux-net channel archive
system calls
daemon@ATHENA.MIT.EDU (Aman Devgan)
Wed Jun 5 04:19:33 1996
From: aman@banga.unl.edu (Aman Devgan)
To: linux-net@vger.rutgers.edu (linux-net)
Date: Tue, 4 Jun 1996 20:48:30 -0500 (CDT)
Cc: aman@banga.unl.edu (Aman Devgan)
Hi,
I am very new to this, so I apologize for the *doh* stuff I am going
to ask.
I want to write a new system call for a project. For, starters I want
to rewrite the existing read call with a different name, so that I
understand what actually happens when that call is executed.
I understand that the root filesystem is ext2. I'd like to know where
all I should make the changes to write this mirror read call.
I could not find the directory /usr/src/libc. Do I have to have it? I
am using Linux 1.2.13. I also did not find the file sys_call.S under
/usr/src/linux/kernel. I was given to understand that I must edit this
file too. Is that right, and if so, where should I get a hold of it.
( I am confused that if I should have had this file, how come the
kernel compiles and I see no problem with the system calls).
So groping about in the dark I did the following. I added
the declaration for this new read at:
1. /usr/include/sys/syscall.h -- added a call "SYS_vod_read" with number
141 just like the SYS_read call with
number 3. I guess these numbers are
Maskable interupts ??
2. /usr/include/sys/i386/syscall.h -- copied _syscall3() to _syscall141()
3. /usr/include/linux/unistd.h -- added the syscall __NR_vod_read 141
for I saw __NR_read 3;
4. /usr/src/linux/include/fs.h -- under ext2_file_operations,
declared function sys_vod_read()
(exactly as sys_read())
Upto step 3, there was no problem with kernel compiling and executing.
After step 4, the new kernel just stops in the middle of booting.
I get this message at boot up:
VFS: Mounted root (ext2 filesystem) read only.
.
.
/etc/rc.d/rc.S : testing filesystem stations: readonly filesystem.
.
.
Remounting root device with Read_Write Enabled.
And after this it just sits there.
What did I do wrong? Can't I add even a declaration of an undefined
call (step 4).
I was meaning to copy the ext2_read() to ext2_vod_read()
and under .../linux/fs/read_write.c, copy sys_read() to
sys_vod_read().
Can someone please give me some pointers on adding new system calls??
Is there some good documentation on this besides the "Linux Kernel Hacker's
guide"?
Thanks a tonne,
--
Aman Devgan