mailing list of musl libc
 help / color / mirror / code / Atom feed
* ldso: dlclose.
@ 2012-08-19 16:26 musl
  2012-08-20  0:48 ` Rich Felker
  0 siblings, 1 reply; 12+ messages in thread
From: musl @ 2012-08-19 16:26 UTC (permalink / raw)
  To: musl

Hi,

I noticed that the dlclose function is not implemented (always return 0).
It might be a problem in my case cause I use dlfuncs to implement a plugin system and when I unload a plugin, the memory
is not released.

Do you plan to implement this function ?

I can work on this but it seems that __cxa_finalize is not implemented either and the 'struct fl' (atexit.c) does not
contain any dso field.
Do you have some concern about how this should be done.

BTW I think there is a bug in the '__funcs_on_exit' (atexit.c) : only the first non null function of each function pool
is called.


Something like this should do the trick.

void __funcs_on_exit()
{
    int i;
    void (*func)(void *), *arg;
    LOCK(lock);
    for (; head; head=head->next) {
        for (i=COUNT-1; i>=0 && !head->f[i]; i--);
        if (i<0) continue;
        for (; i>=0; i--) {
            func = head->f[i];
            arg = head->a[i];
            head->f[i] = 0;
            UNLOCK(lock);
            func(arg);
            LOCK(lock);
        }
    }
}

Regards,

Boris


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-08-25  7:54 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-19 16:26 ldso: dlclose musl
2012-08-20  0:48 ` Rich Felker
2012-08-22 22:41   ` Rich Felker
2012-08-23 12:39   ` Arvid E. Picciani
2012-08-23 12:48     ` Rich Felker
2012-08-23 16:02       ` orc
2012-08-23 18:01         ` Rich Felker
2012-08-24  7:52           ` musl
2012-08-24 12:27             ` Rich Felker
2012-08-24 13:54               ` musl
2012-08-24 17:46                 ` Rich Felker
2012-08-25  7:54                   ` boris brezillon

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).