Date: Wed, 23 Dec 1998 00:13:05 +0200 From: Jeremy Lea <reg@shale.csir.co.za> To: Richard Seaman <dick@tar.com> Cc: freebsd-current@FreeBSD.ORG Subject: Threads in WINE [was: linking against libc_r] Message-ID: <19981223001304.A319@shale.csir.co.za> In-Reply-To: <19981221114939.A5500@tar.com>; from Richard Seaman on Mon, Dec 21, 1998 at 11:49:39AM -0600 References: <Pine.BSF.4.05.9812210104430.479-100000@smarter.than.nu> <Pine.BSF.4.05.9812211024340.6331-100000@bright.fx.genx.net> <19981221093241.C546@tar.com> <19981221192734.E4060@shale.csir.co.za> <19981221114939.A5500@tar.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19981223001304.A319>
