Threading system calls (int 80h)

Divacky Roman xdivac02 at stud.fit.vutbr.cz
Tue Oct 17 01:11:01 PDT 2006


On Mon, Oct 16, 2006 at 02:08:59PM +0200, Marco van de Voort wrote:
> > 
> > On Sunday 15 October 2006 01:32, David Xu wrote:
> > > You are going to be unable to use libc if you create raw thread in your
> > > program, libc uses pthread APIs, if you create a raw thread, your
> > > program will crash if you use any libc function which needs pthread
> > > interface.
> > 
> > I don't want to link to libc. So, how do I create a raw thread?
> 
> (digging deep into memory)
> 
> Have a look how the linuxator emulates the clone() syscall with (IIRC)
> rfork. A limited route, but iirc it works.

linuxolator clone() uses fork1() which is unaccessible from outside kernel.
there is a "user space implementation" of clone() in linuxthreads which uses
rfork() but rfork creates "normal processes". but you can pass flags to rfork()
thus emulation most of the needs of threads (shared memory etc.)

roman


More information about the freebsd-hackers mailing list