From owner-freebsd-hackers@FreeBSD.ORG Tue Oct 17 08:11:01 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7379F16A403; Tue, 17 Oct 2006 08:11:01 +0000 (UTC) (envelope-from xdivac02@stud.fit.vutbr.cz) Received: from eva.fit.vutbr.cz (eva.fit.vutbr.cz [147.229.176.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 15ABC43D7E; Tue, 17 Oct 2006 08:10:59 +0000 (GMT) (envelope-from xdivac02@stud.fit.vutbr.cz) Received: from eva.fit.vutbr.cz (localhost [127.0.0.1]) by eva.fit.vutbr.cz (envelope-from xdivac02@eva.fit.vutbr.cz) (8.13.8/8.13.7) with ESMTP id k9H8AuaY073322 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 17 Oct 2006 10:10:56 +0200 (CEST) Received: (from xdivac02@localhost) by eva.fit.vutbr.cz (8.13.8/8.13.3/Submit) id k9H8AuLG073321; Tue, 17 Oct 2006 10:10:56 +0200 (CEST) Date: Tue, 17 Oct 2006 10:10:56 +0200 From: Divacky Roman To: Marco van de Voort Message-ID: <20061017081056.GA73188@stud.fit.vutbr.cz> References: <200610150326.03279.ekkehard.morgenstern@onlinehome.de> <20061016120859.E146C2287D@snail.stack.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20061016120859.E146C2287D@snail.stack.nl> User-Agent: Mutt/1.4.2.2i X-Scanned-By: MIMEDefang 2.57 on 147.229.176.14 Cc: freebsd-hackers@freebsd.org, Ekkehard Morgenstern , David Xu Subject: Re: Threading system calls (int 80h) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Oct 2006 08:11:01 -0000 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