rfork(RFPROC|RFMEM)

Terry Lambert tlambert2 at mindspring.com
Mon May 5 20:32:53 PDT 2003


Igor Sysoev wrote:
> On Mon, 5 May 2003, Terry Lambert wrote:
> What is stack glue ?

See the code in fork1() in /sys/kern/kern_fork.c.


> I use rfork_thread(3) wrapper that allows to setup another stack for
> rfork()ed process.
>
> What RFTHREAD flag does ?

See the code.  It basically sets up for kernel threading, rather
than merely for processes sharing the same address space and/or
file descriptor table and/or heap, which is what rfork was
intended to be able to do.  It also ensures propagation of any
SIGKILL to all peers, so they die all at once, in exit1() in 
/sys/kern/kern_exit.c.


> By the way linuxthreads port always uses RFTHREAD flag.

They don't know any other way than the moral equivalent of
the Linux "clone" system call, so that's what they use; it's
technically not necessary.  See also the source code in the
directory /usr/src/lib/libpthread, which doesn't use rfork()
at all.

-- Terry


More information about the freebsd-arch mailing list