From owner-freebsd-bugs@FreeBSD.ORG Wed Nov 3 22:00:26 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1BAFD106566B for ; Wed, 3 Nov 2010 22:00:26 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id E3FE08FC15 for ; Wed, 3 Nov 2010 22:00:25 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id oA3M0PDF048589 for ; Wed, 3 Nov 2010 22:00:25 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id oA3M0P4H048555; Wed, 3 Nov 2010 22:00:25 GMT (envelope-from gnats) Date: Wed, 3 Nov 2010 22:00:25 GMT Message-Id: <201011032200.oA3M0P4H048555@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Alexander Kabaev Cc: Subject: Re: misc/151861: dlclose() of library causes separately opened libraries to unload as well X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Alexander Kabaev List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Nov 2010 22:00:26 -0000 The following reply was made to PR misc/151861; it has been noted by GNATS. From: Alexander Kabaev To: Kostik Belousov Cc: Jaakko Heinonen , bug-followup@freebsd.org, kan@freebsd.org Subject: Re: misc/151861: dlclose() of library causes separately opened libraries to unload as well Date: Wed, 3 Nov 2010 17:55:42 -0400 --Sig_/ykcQFMB+TmLB+hf/2HXyXRY Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Wed, 3 Nov 2010 18:37:56 +0200 Kostik Belousov wrote: > On Wed, Nov 03, 2010 at 12:27:33PM -0400, Alexander Kabaev wrote: > > On Wed, 3 Nov 2010 18:20:30 +0200 > > Kostik Belousov wrote: > > ... > > > ready initialized DAGs but feel free to do whatever you think is > > > > best. =20 > > > I do not like it too, but this is the current interface of > > > init_dag(). Intermediate version of the latest patch removed the > > > ref_dag() part from init_dag(). Would you prefer this ? > >=20 > > I would, but I lack time following all the patch versions flying > > around, so I am not sure I am talking about the right one. >=20 > By intermediate I mean private intermediate state in my working tree. > Below is the patch augmented with the change to not call ref_dag() > from init_dag(). >=20 > diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c > index f1ffc3e..b5fb6e1 100644 > --- a/libexec/rtld-elf/rtld.c > +++ b/libexec/rtld-elf/rtld.c > @@ -1276,7 +1276,7 @@ init_dag(Obj_Entry *root) > DoneList donelist; > =20 > if (root->dag_inited) > - return; > + return; > donelist_init(&donelist); > init_dag1(root, root, &donelist); > root->dag_inited =3D true; > @@ -1290,7 +1290,6 @@ init_dag1(Obj_Entry *root, Obj_Entry *obj, > DoneList *dlp) if (donelist_check(dlp, obj)) > return; > =20 > - obj->refcount++; > objlist_push_tail(&obj->dldags, root); > objlist_push_tail(&root->dagmembers, obj); > for (needed =3D obj->needed; needed !=3D NULL; needed =3D > needed->next) @@ -2031,6 +2030,7 @@ dlopen(const char *name, int mode) > assert(*old_obj_tail =3D=3D obj); > result =3D load_needed_objects(obj, RTLD_LO_DLOPEN); > init_dag(obj); > + ref_dag(obj); > if (result !=3D -1) > result =3D rtld_verify_versions(&obj->dagmembers); > if (result !=3D -1 && ld_tracing) > @@ -2054,10 +2054,8 @@ dlopen(const char *name, int mode) > * already loaded as a dependency, initialize the dag > * starting at it. > */ > - if (obj->dl_refcount =3D=3D 1) > - init_dag(obj); > - else > - ref_dag(obj); > + init_dag(obj); > + ref_dag(obj); > =20 > if (ld_tracing) > goto trace; This is one that is least confusing and I like it. Thanks.=20 --=20 Alexander Kabaev --Sig_/ykcQFMB+TmLB+hf/2HXyXRY Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iD8DBQFM0dpnQ6z1jMm+XZYRAn1DAKC2AOFZjncDv3aIwYHdciHTN28nOACg5d/X YZmVyabqGdtJC3+czb+KZUo= =FiaC -----END PGP SIGNATURE----- --Sig_/ykcQFMB+TmLB+hf/2HXyXRY--