Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Mar 2005 12:29:07 +0530
From:      "Andriy Tkachuk" <andrit@ukr.net>
To:        <threads@freebsd.org>
Subject:   Re: patch for threads/76690 - critical - fork hang in child for -lc_r
Message-ID:  <001a01c51fbe$81472d60$090210ac@BORJA>
References:  <Pine.GSO.4.43.0503021042310.26125-100000@sea.ntplx.net>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.

------=_NextPart_000_0017_01C51FEC.980DEEC0
Content-Type: text/plain;
	charset="ISO-8859-1"
Content-Transfer-Encoding: 7bit


> This is already fixed in libpthread in both -current and -stable.
> Your patch also pollutes the application namespace with a global
> symbol thread_lock -- there is already a symbol in malloc.c that
> is there just for this purpose (__malloc_lock).

yea, i see - you right. i just didn't noticed that this one is already
without
static. thanks.

Ok, now the libc don't changed, and updated patch see in attachment.

Thanks,
  Andriy.

------=_NextPart_000_0017_01C51FEC.980DEEC0
Content-Type: application/octet-stream;
	name="libc_r-76690pr.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="libc_r-76690pr.patch"

diff -r -u lib/libc_r/uthread/uthread_fork.c =
lib.patched/libc_r/uthread/uthread_fork.c=0A=
--- lib/libc_r/uthread/uthread_fork.c	Fri Dec 10 09:06:45 2004=0A=
+++ lib.patched/libc_r/uthread/uthread_fork.c	Thu Mar  3 12:17:01 2005=0A=
@@ -62,6 +62,9 @@=0A=
 =0A=
 	_pthread_mutex_lock(&_atfork_mutex);=0A=
 =0A=
+	extern spinlock_t *__malloc_lock;=0A=
+	_SPINLOCK(__malloc_lock);=0A=
+=0A=
 	/* Run down atfork prepare handlers. */=0A=
 	TAILQ_FOREACH_REVERSE(af, &_atfork_list, atfork_head, qe) {=0A=
 		if (af->prepare !=3D NULL)=0A=
@@ -70,6 +73,8 @@=0A=
 =0A=
 	/* Fork a new process: */=0A=
 	if ((ret =3D __sys_fork()) !=3D 0) {=0A=
+		_SPINUNLOCK(__malloc_lock);=0A=
+=0A=
 		/* Run down atfork parent handlers. */=0A=
 		TAILQ_FOREACH(af, &_atfork_list, qe) {=0A=
 			if (af->parent !=3D NULL)=0A=
@@ -78,6 +83,8 @@=0A=
 		_pthread_mutex_unlock(&_atfork_mutex);=0A=
 =0A=
 	} else {=0A=
+		_SPINUNLOCK(__malloc_lock);=0A=
+=0A=
 		/* Close the pthread kernel pipe: */=0A=
 		__sys_close(_thread_kern_pipe[0]);=0A=
 		__sys_close(_thread_kern_pipe[1]);=0A=

------=_NextPart_000_0017_01C51FEC.980DEEC0--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?001a01c51fbe$81472d60$090210ac>