Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 02 May 2012 18:13:45 +0200
From:      =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@des.no>
To:        Baptiste Daroussin <bapt@freebsd.org>
Cc:        Konstantin Belousov <kostikbel@gmail.com>, freebsd-arch@freebsd.org
Subject:   Re: Switching /etc/*.db from bdb to tinycdb
Message-ID:  <86txzyh87a.fsf@ds4.des.no>
In-Reply-To: <20120502145045.GP31034@azathoth.lan> (Baptiste Daroussin's message of "Wed, 2 May 2012 16:50:46 %2B0200")
References:  <20120502114115.GG31034@azathoth.lan> <CA%2BhQ2%2Bgv%2BQ7SXbK-G5Lybjt4XOF_b3EvyxtQiOCL7pGxmgWRcg@mail.gmail.com> <20120502123149.GI31034@azathoth.lan> <20120502140235.GA91732@onelab2.iet.unipi.it> <20120502134546.GM31034@azathoth.lan> <20120502144706.GZ2358@deviant.kiev.zoral.com.ua> <20120502145045.GP31034@azathoth.lan>

next in thread | previous in thread | raw e-mail | index | archive | help
Baptiste Daroussin <bapt@freebsd.org> writes:
> Konstantin Belousov <kostikbel@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
--=20
Dag-Erling Sm=C3=B8rgrav - des@des.no



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86txzyh87a.fsf>