> On 7/6/05, Shrinand Javadekar <[EMAIL PROTECTED]> wrote:
> > If a function is written in a kernel module (and not hooked to any
> > syscall) and that kernel module is loaded in memory, can user-land
> > programs call that function?
> no. There are only 2 paths into the kernel: either system calls, or
> interrupts (people may argue that they are infact, the same, but
> atleast logically, these are the 2 paths). Of this of course, the
> syscall interface is the only one available to userland.

Well technically thats true, but in general kernel exports general
purpose syscalls by providing char/bulk/network/socket interfaces (and
now a days proc fs interface) which are standard ways to interact with
kernel codes. And any kernel coder should be thinking in those terms
unless you are adding something like a whole new subsystem that is so
wiered that everything is a file approach is not catering to your
needs ( i doubt you will ever run into one)

Also interrupts can't be of much use to userspace code, as far as
direct access to the kernel functions is required.
 
> > Also, does making an entry in the syscall table mean writing an
> > interrupt handler?
> As far as i know (which ain't a lot), No, it does not... atleast not
> literally...

No!! 
Syscall handler is one big interrupt handler which on intel arch handles int80.

Based on the stack arguments and regs it determines the sycall number
that userspace requested and then selects a function to execute from
the syscall table.
adding a syscall means adding to this table...... and then exporting
right definitions (eg syscall number and its arguments ) to userspace
through syscall header files.
then ofcourse you will have to write or extend glibc part of the
syscall in  order to cleanly provide the new functionality to user
applications.

> 
> Adding a system call is a rather drastic measure (or rather, extremely
> drastic measure). Have you explored other alternatives? (daemons
> running in kernel mode, and userland processes communicating with them
> using pipes/sockets, as an example)

correct syscall is a done deal atleast for now in linux, any new
syscall will mean a huge debate and a decade or so of testing in wild
before its even considered for inclusion. (well not really, but lkml
people make it sound like this to a newbee, so you should get the
point)

hth
BAIN

--
______________________________________________________________________
Pune GNU/Linux Users Group Mailing List:      (plug-mail@plug.org.in)
List Information:  http://plug.org.in/mailing-list/listinfo/plug-mail
Send 'help' to [EMAIL PROTECTED] for mailing instructions.

Reply via email to