In article <[EMAIL PROTECTED]>,
Brian McGovern <[EMAIL PROTECTED]> wrote:
> I'm playing with an application that uses dlopen() to load some libraries. I
> use the _init function to set the libraries up. I've also set up the _fini
> functions to shut things down.
>
> I see, in the man page, that dlclose() will unload the libraries and call
> _fini.
>
> My question is whether or not exit() does the same thing? It currently does
> not appear to, although that would seem rather odd to me, given the other
> types of cleanup it does.
It should clean them up including calling their _fini functions. From
src/libexec/rtld-elf/rtld.c:
/*
* Cleanup procedure. It will be called (by the atexit mechanism) just
* before the process exits.
*/
static void
rtld_exit(void)
{
Obj_Entry *obj;
dbg("rtld_exit()");
wlock_acquire();
/* Clear all the reference counts so the fini functions will be called. */
for (obj = obj_list; obj != NULL; obj = obj->next)
obj->refcount = 0;
wlock_release();
objlist_call_fini(&list_fini);
/* No need to remove the items from the list, since we are exiting. */
}
If you can come up with a reasonably self-contained test case that
shows a bug in this, I'll be happy to take a look at it.
John
--
John Polstra [EMAIL PROTECTED]
John D. Polstra & Co., Inc. Seattle, Washington USA
"Disappointment is a good sign of basic intelligence." -- Chögyam Trungpa
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message