From owner-freebsd-current Tue Dec 22 14:13:34 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id OAA16847 for freebsd-current-outgoing; Tue, 22 Dec 1998 14:13:34 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from shale.csir.co.za (shale.csir.co.za [146.64.46.5]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id OAA16722 for ; Tue, 22 Dec 1998 14:13:28 -0800 (PST) (envelope-from reg@shale.csir.co.za) Received: (from reg@localhost) by shale.csir.co.za (8.9.1/8.9.1) id AAA68236; Wed, 23 Dec 1998 00:13:05 +0200 (SAT) (envelope-from reg) Date: Wed, 23 Dec 1998 00:13:05 +0200 From: Jeremy Lea To: Richard Seaman Cc: freebsd-current@FreeBSD.ORG Subject: Threads in WINE [was: linking against libc_r] Message-ID: <19981223001304.A319@shale.csir.co.za> References: <19981221093241.C546@tar.com> <19981221192734.E4060@shale.csir.co.za> <19981221114939.A5500@tar.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95i In-Reply-To: <19981221114939.A5500@tar.com>; from Richard Seaman on Mon, Dec 21, 1998 at 11:49:39AM -0600 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi, On Mon, Dec 21, 1998 at 11:49:39AM -0600, Richard Seaman wrote: > On Mon, Dec 21, 1998 at 07:27:35PM +0200, Jeremy Lea wrote: > > > > Wine seems to want clone(), from a quick read of the man page. Does the > > native LinuxThreads stuff implement this as a FreeBSD syscall? > > The FreeBSD "port" of Linux threads does not use nor implement a clone > syscall. It uses rfork instead within pthread_create to simulate > the clone call. If Wine calls "clone" directly, rather than via > the phread_create call, it would be easy enough to implement a > FreeBSD call, either in libc or as a syscall, that mimics clone. > > Actually, there are already two "clone" calls within Linux Threads > right now. There is a wrapper "clone" call that wraps the clone > syscall (see clone.S in the linux threads source). Well, I finally got to looking at the source. It uses clone() directly. In fact there is no mention of libpthread at all. But there is the following extract from wine-981211/include/threads.h: --- #ifdef linux #define HAVE_CLONE_SYSCALL #endif /* This is what we will use on *BSD, once threads using rfork() get * implemented: * * #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) * #define HAVE_RFORK * #endif */ #if (defined(HAVE_CLONE_SYSCALL) || defined(HAVE_RFORK)) && !defined(NO_REENTRANT_LIBC) #define USE_THREADS #endif --- and from wine-981211/scheduler/sysdeps.c: --- int SYSDEPS_SpawnThread( THDB *thread ) { #ifdef USE_THREADS #ifdef HAVE_CLONE_SYSCALL if (clone( (int (*)(void *))SYSDEPS_StartThread, thread->teb.stack_top, CLONE_VM | CLONE_FS | CLONE_FILES | SIGCHLD, thread ) < 0) return -1; /* FIXME: close the child socket in the parent process */ /* close( thread->socket );*/ #endif #ifdef HAVE_RFORK FIXME(thread, "Threads using rfork() not implemented\n" ); #endif #else /* !USE_THREADS */ FIXME(thread, "CreateThread: stub\n" ); #endif /* USE_THREADS */ return 0; --- These are the only mentions for HAVE_CLONE_SYSCALL and HAVE_RFORK. Does this make your mind tick any? The only other condition is a reentrant libc it would seem... Regards -Jeremy -- | "I could be anything I wanted to, but one things true --+-- Never gonna be as big as Jesus, never gonna hold the world in my hand | Never gonna be as big as Jesus, never gonna build a promised land | But that's, that's all right, OK with me..." -Audio Adrenaline To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message