question about change in inet_ntoa.c

Giorgos Keramidas keramida at ceid.upatras.gr
Tue Feb 26 11:51:37 UTC 2008


On 2008-02-26 11:51, ithilgore <ithilgore.fbsd at gmail.com> wrote:
> Giorgos Keramidas wrote:
>> I don't see ucp[] in RELENG_6, RELENG_7 or CURRENT.  Where did you get
>> the version shown as `7.0-RC1' above?
> 
> I got the source code from the ftp.freebsd.org and I just downloaded 
> 7.0-RC3 to be certain.
> Both in 7.0-RC1 and in 7.0-RC3 in src/sys/libkern/ is the following code of 
> inet_ntoa.c :
> 
> #include <sys/cdefs.h>
> __FBSDID("$FreeBSD: src/sys/libkern/inet_ntoa.c,v 1.6 2005/01/07 00:24:32 
> imp Exp $");

That's libkern.  It's part of the kernel code, and it cannot depend on
the same basic assumptions as /usr/src/lib/libc code.

The kernel version of sprintf() is implemented in sys/kern/subr_prf.c.

> .....followed by the reentrant version of inet_ntoa : inet_ntoa_r
> 
> 
> On the other hand, in version 4.11 RELEASE in 
> /usr/src/lib/libc/net/inet_ntoa.c &
> inet_ntop.c (actually it is inet_ntop.c code but with the same 
> functionality) which is
> called by inet_ntoa there is :

This, on the other hand, is userlevel code.  There is a userlevel
implementation of the printf() family of functions in libc.

The two versions do not necessarily work in an 100% compatible manner,
so it's probably a slightly bad idea to 'fix' kernel code to use the
libc/userlevel style of sprintf("%u....").



More information about the freebsd-net mailing list