Switching /etc/*.db from bdb to tinycdb

Dag-Erling Smørgrav des at des.no
Wed May 2 16:13:47 UTC 2012


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.

DES
-- 
Dag-Erling Smørgrav - des at des.no


More information about the freebsd-arch mailing list