[OpenWrt-Devel] tdestroy in musl works differently to glibc?

Luke McKee hojuruku at gmail.com
Sun Jul 24 04:03:29 EDT 2016

Slowly getting the accel-pppd package done...

Lots of missing headers, as their usually are with musl vs glibc and a
problem relating to atomic memory ops are already fixed as openwrt
people bumped into the same issue with rtorrent.

<hojuruku> error: '__free_fn_t' undeclared (first use in this function)
<hojuruku> that's used with tdestroy (search.h) with glibc, where's
the docs on tdestroy with musl?

Other's have run into this:


Normally I'd spend some more time trying to patch alone. Already got 3
down and 67% of it building.

TARGET_CFLAGS+= -D_GNU_SOURCE and __free_fn_t still isn't declared.

Alsa-lib has it's own bundled include/search.h that includes the
necessary typedef __free_fn_t

#ifdef __USE_GNU
/* Callback type for function to free a tree node.  If the keys are atomic
   data this function should do nothing.  */
typedef void (*__free_fn_t) __PMT ((void *__nodep));

/* Destroy the whole tree, call FREEFCT for each node or leaf.  */
extern void tdestroy __PMT ((void *__root, __free_fn_t __freefct));

This is the code needing fixing:

static void l2tp_tunnel_free_sessions(struct l2tp_conn_t *conn)
        void *sessions = conn->sessions;

        conn->sessions = NULL;
        tdestroy(sessions, (__free_fn_t)l2tp_session_free);
        /* Let l2tp_session_free() handle the session counter and
         * the reference held by the tunnel.
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list