tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

resolver function namespace protection



Most people don't notice, but although we supply all the "new"
resolver functions (res_ninit and friends), configure scripts don't
find them because of the way namespace protection is done in
<resolv.h>:

    #define res_ninit               __res_ninit  

This is because autoconf does not include the header in its test
to find the symbol, so it does not find "res_ninit".

I would like to fix that.

One way (the simplest) to fix this is to leave things the way they
are and add weak references to all the renamed symbols by adding:

    __weak_alias(res_ninit, __res_ninit)
    ...

to a file in libc, so that we keep the old __'ed names and leave
it at that.

I propose though that we go one (or two) steps further, and remove
the defines from <resolv.h>, and put them in libc/include/namespace.h
with all the rest of the renamed symbols as the second step. This is
desirable because it unclutters resolv.h and puts all the renamed
symbols in one place (or at least one place that I know of).

As a third (optional step), I propose that we move all the
__weak_aliases() from the libc c files, and autogenerate them into
a single c file. This way, in the future if we decide to get rid
of them for a different mechanism (like symbol renames) this will
become easier.

Comments?

christos


Home | Main Index | Thread Index | Old Index