Switching /etc/*.db from bdb to tinycdb

Konstantin Belousov kostikbel at gmail.com
Wed May 2 16:24:34 UTC 2012


On Wed, May 02, 2012 at 06:13:45PM +0200, Dag-Erling Sm??rgrav wrote:
> Baptiste Daroussin <bapt at freebsd.org> writes:
> > Konstantin Belousov <kostikbel at gmail.com> writes:
> > > The reasoning is that we do not want our libc unneccessary interpose
> > > symbols from third-party libs, and do not want to make a surprise for
> > > somebody who wants to use the never version of the same library, or use
> > > a symbol not documented in SUSv4 etc while linking to libc/libpthread
> > > only.
> > I do understand that, I know need to learn how we can do that cleaning
> 
> If we go that route, I would suggest having the complete library as
> libcdb, and a copy of the read part hidden inside libc for getpw*() etc.
> 
> To hide the cdb code inside libc, you need to add
> 
> #define cdb_foo _cdb_foo
> 
> to src/lib/libc/include/namespace.h and
> 
> #undef cdb_foo
> 
> to src/lib/libc/include/un-namespace.h, for appropriate values of "foo"
> ("init", "find" etc.), then wrap the #include directives in the cdb
> source with #include <namespace.h> /* ... */ #include <un-namespace.h>.
> Within libc, you must call _cdb_foo() instead of cdb_foo(); outside of
> libc, you call cdb_foo() as usual, and link with -lcdb.
> 
> To avoid duplicating the cdb source code, you will need to create
> src/lib/libcdb/{un-,}namespace.h as empty files and add -I${SRCDIR} to
> CFLAGS in src/lib/libcdb/Makefile.
The _[a-z] symbols are in application namespace, so the typical namespace.h
gymnastic is somewhat doubtful. It is indeed needed for the exported
symbols, to allow both interposing and libc usage of the right symbol
internally.

I do not think we need this at all for cdb, which symbols we should not
export from libc. Just do not expose symbols, i.e. do not mention them
in the version script for libc, is enough. The static linking is the
lost case anyway.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20120502/ef958d6d/attachment.pgp


More information about the freebsd-arch mailing list