Subject: Re: Why no /usr/include/sys/kthread.h?
To: Jason R Thorpe <firstname.lastname@example.org>
From: Frederick Bruckman <email@example.com>
Date: 06/04/2000 23:03:27
On Sun, 4 Jun 2000, Jason R Thorpe wrote:
> On Sun, Jun 04, 2000 at 07:48:09AM -0500, Frederick Bruckman wrote:
> > 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.)
That's a little over my head. If anyone else want's to pick that up,
it looks like only a partial implementation of clone() would allow
"wine" to work. The clone() form of SYSDEPS_SpawnThread() only sets
the flags CLONE_VM|CLONE_FS|SIGCHILD, and CLONE_FS is only used to
make chdir() visible to fellow clones. It especially doesn't call for
sharing the file descriptors (CLONE_FILES).