`Hiding' libc symbols (was Re: cvs commit: src/lib/libc/gen ...)

Jacques A. Vidrine nectar at FreeBSD.org
Thu May 1 07:53:48 PDT 2003


On Thu, May 01, 2003 at 03:46:00PM +0100, Paul Richards wrote:
[...]
> > No, it is done for some 150+ functions.  If the technique didn't have
> 
> 150+? I must have missed that in the commit and subsequent discussion.

See src/lib/libc/include/namespace.h .

[...]
> Hmm, perhaps a more correct implementation of our libc would not
> use the exported interface to implement the exported interface
> (thinking aloud).
> 
> i.e. there'd be a _strlcpy that strlcpy was just a wrapper for
> and internally the _strlcpy would be used.

Oh, Paul.  That is exactly what we are doing today.

strlcpy.c:

     41 __weak_reference(_strlcpy, strlcpy);
     42 /*
     43  * Copy src to string dst of size siz.  At most siz-1 characters
     44  * will be copied.  Always NUL terminates (unless siz == 0).
     45  * Returns strlen(src); if retval >= siz, truncation occurred.
     46  */
     47 size_t _strlcpy(dst, src, siz)
     48         char *dst;
     49         const char *src;
     50         size_t siz;
     51 {

A libc consumer (getpwent.c):
    587             namesize = _strlcpy(&keybuf[1], name, sizeof(keybuf)-1);



Cheers,
-- 
Jacques Vidrine   . NTT/Verio SME      . FreeBSD UNIX       . Heimdal
nectar at celabo.org . jvidrine at verio.net . nectar at freebsd.org . nectar at kth.se


More information about the freebsd-arch mailing list