Re: Problem creating a new system call

Tim Hockin (thockin@eagle.ais.net)
Fri, 10 Oct 1997 17:18:23 -0500 (CDT)


> #define __NR_prefetch 164

> #include <linux/unistd.h>
> _syscall2 (int, bdflush, int, mode, int, nr_hints)
^^^^^^^

Why bdflush? should that not be prefetch ? When this macro
expands it builds some assembler that calls the syscall interrupt,
which goes to teh syscall table with an offset of __NR_parameter2 (in
this case bdflush, when you really want prefetch). the __NR you #defined
to 164. by making the line

.long SYMBOL_NAME(sys_prefetch)

the 164th line of the syscall_table (in entry.S), the asm macro enters the
syscall routine, jumps 164 entries, then executes at the address in the
table (This is called the vector, I believe).

> This code compiles and runs but always returns a -1 value and does not
> even print the messages on the screen that I inserted using printk() in the
> system call code in buffer.c

well, if you look at the man page for bdflush(2) which is what you are
calling (woops) it returns -EPERM (-1)

> Since the messages are not getting printed, I have no way to know if
> the system call is getting called AT ALL !!!

well, you do have a good idea that it is NOT being executed ;)

If I am wrong on any of this, PLEASE correct me, anyone.
That is how I understand it, and after three days of reading a lot of
code, is how I have made it work :)

Tim

-- 
Tim Hockin
thockin@ais.net
This program has been brought to you by the language C and the number F.