Date: Wed, 3 Nov 2010 15:10:09 GMT From: Jaakko Heinonen <jh@FreeBSD.org> To: freebsd-bugs@FreeBSD.org Subject: Re: misc/151861: dlclose() of library causes separately opened libraries to unload as well Message-ID: <201011031510.oA3FA9Xp026054@freefall.freebsd.org>
index | next in thread | raw e-mail
The following reply was made to PR misc/151861; it has been noted by GNATS.
From: Jaakko Heinonen <jh@FreeBSD.org>
To: Kostik Belousov <kostikbel@gmail.com>
Cc: Arjan van Leeuwen <freebsd-maintainer@opera.com>,
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:02:24 +0200
On 2010-11-03, Kostik Belousov wrote:
> > Why init_dag() should be allowed to be called multiple times for an
> > object?
>
> If already loaded object is dlopened, dlclosed, and then again dlopened,
> init_dag() will be called twice, one time for each dlopen.
If the object gets unloaded after dlclose(), this will not happen? I am
not sure if I like that it can be called multiple times.
> --- a/libexec/rtld-elf/rtld.c
> +++ b/libexec/rtld-elf/rtld.c
> @@ -1275,11 +1275,12 @@ init_dag(Obj_Entry *root)
> {
> DoneList donelist;
>
> - if (root->dag_inited)
> - return;
> - donelist_init(&donelist);
> - init_dag1(root, root, &donelist);
> - root->dag_inited = true;
> + if (!root->dag_inited) {
> + donelist_init(&donelist);
> + init_dag1(root, root, &donelist);
> + root->dag_inited = true;
> + }
> + ref_dag(root);
> }
If you are going to take this approach, why not remove init_dag() altogether
and make ref_dag() to initialize the dag when necessary?
Thanks for working on this.
--
Jaakko
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011031510.oA3FA9Xp026054>
