Subject: Re: Why no /usr/include/sys/kthread.h?
To: Frederick Bruckman <fb@enteract.com>
From: Jason R Thorpe <thorpej@zembu.com>
List: tech-kern
Date: 06/04/2000 08:29:42
On Sun, Jun 04, 2000 at 07:48:09AM -0500, Frederick Bruckman wrote:

 > It says in kern/kern_kthread.c that any process can fork a kernel
 > thread. Is that true? If so, will the interface be exported in 1.5?
 > 
 > I ask because, in looking at the "wine" FreeBSD assembly, it seems
 > that all it's trying to do is start a single "wineserver" kthread.
 > It seems the natural way to do this on NetBSD would be to call
 > kthread_create(). Does that make sense?

FreeBSD's `kthread' term refers to a user process created with rfork(2)
that shares all of the same address space, file descriptors, etc. with
the parent, i.e. like Linux's __clone(2).

kthreads in NetBSD are completely different; they are for the kernel's
use only.

What you should do is add a __clone(2) to the NetBSD C library; we already
have all the support for it in the kernel, and there's precedent for it
(Linux).  (Editorial note: calling it rfork(2) would be wrong, since the
semantics needed would be incompatible with the original rfork(2) from
Plan 9.)

-- 
        -- Jason R. Thorpe <thorpej@zembu.com>