Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Sun, 19 Aug 2012 18:26:45 +0200
From: musl <b.brezillon.musl@...il.com>
To: musl@...ts.openwall.com
Subject: ldso: dlclose.

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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.