Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Feb 2008 12:39:53 +0200
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        ithilgore <ithilgore.fbsd@gmail.com>
Cc:        freebsd-net@freebsd.org
Subject:   Re: question about change in inet_ntoa.c
Message-ID:  <20080226103953.GA2399@kobe.laptop>
In-Reply-To: <47C46DCF.6050202@gmail.com>
References:  <47BFF17B.5080205@gmail.com> <47BFF74E.4010608@gmail.com> <20080226040438.GA2676@kobe.laptop> <47C46DCF.6050202@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2008-02-26 11:51, ithilgore <ithilgore.fbsd@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....").




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