execute a user process in the kernel

Dag-Erling Smørgrav des at des.no
Fri Sep 24 09:21:27 PDT 2004


Mike Meyer <mwm at mired.org> writes:
> Gordon David <kylincsos at hotmail.com> writes:
> > Kqueue is a good method to notify the user. But I want the code in
> > the kernel directly calls a user program.
> How about starting with the code in kern/kern_exec.c?

execve(2) assumes you already have a process.  You get a process by
forking another process.  The only process we ever create from scratch
is init(8), and that takes a s**tload of work (see kern/init_main.c).
This is why we have stuff like nfsiod(8) which does nothing but
provide the kernel with a process context it can use for other stuff.

You could, of course, write a kernel API for creating processes from
scratch.  They'd still need a parent, but you can use init(8) (pid 1)
for that.

DES
-- 
Dag-Erling Smørgrav - des at des.no


More information about the freebsd-hackers mailing list