From owner-freebsd-current@FreeBSD.ORG Sun Jul 29 01:39:07 2012 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D674D1065670 for ; Sun, 29 Jul 2012 01:39:07 +0000 (UTC) (envelope-from lacombar@gmail.com) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 5ED338FC1B for ; Sun, 29 Jul 2012 01:39:07 +0000 (UTC) Received: by weyx56 with SMTP id x56so3422934wey.13 for ; Sat, 28 Jul 2012 18:39:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=kSiC6sIQis5tWFhVaIqGRNaDiRUv9e2G+J5tr8U6Z18=; b=D6BaybSedBu7W7rJ9FeshZO70sgngFafC+xlWbQDJw3q7WWDpmmN2lbSiMdDUrSBOx dw5nDZ4dixBOy5OBHHxjr70VmIAnbGdCkD5VwTUWltHJc11do/yPqB+4rUv3BBKORKyZ 1cHMFomcRbuF/EK5kXHc59KW3IjHAQ9L9gOocuViFY6B1sMh5RNvL6+Zg5TanwevU7EN e/EuF1lHFMAoVVqzu97wx7yqBazyeussLSPG+XRJcxTKBcdl+w54kc1t01xl57uiQhcb z54ijQVLxDQvnlydhg9pdG0SeAzjXVp5ExNkPOlpZry+QSyi3GZg6btDNquS0tyT2p+i 4l3Q== MIME-Version: 1.0 Received: by 10.180.84.169 with SMTP id a9mr16566497wiz.8.1343525946148; Sat, 28 Jul 2012 18:39:06 -0700 (PDT) Received: by 10.216.199.31 with HTTP; Sat, 28 Jul 2012 18:39:06 -0700 (PDT) In-Reply-To: References: <20120725155211.GA33971@onelab2.iet.unipi.it> Date: Sat, 28 Jul 2012 21:39:06 -0400 Message-ID: From: Arnaud Lacombe To: "Bjoern A. Zeeb" Content-Type: text/plain; charset=ISO-8859-1 Cc: Luigi Rizzo , current@freebsd.org Subject: Re: RFC: libkern version of inet_ntoa_r X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jul 2012 01:39:07 -0000 Hi, On Sat, Jul 28, 2012 at 7:46 PM, Arnaud Lacombe wrote: > Hi, > > On Sat, Jul 28, 2012 at 6:44 PM, Bjoern A. Zeeb > wrote: >> Which again leaves me with the question - why does libc have it? >> > as for the semantic, theoretical, "why", I would refer you to the > POSIX's comity, as inet_ntop() is part of it. > actually, it is slightly more complicated than that. POSIX has inet_ntoa(), inet_ntop() and no inet_ntoa_r(). libc's inet_ntoa{,_r}() are implemented on top inet_ntop(), which *does* fail if the provided buffer is not large enough, and set errno to ENOSPC. However, inet_ntoa{,_r}() do not propagate inet_ntop() failure. As for the userland version of inet_ntoa{,_r}(), I would change it to at least stop ignoring inet_ntop() return value, add an assertion on its success, drop this awful `strcpy(ret, "[inet_ntoa error]");' and use the proper size in inet_ntoa() definition. As for the kernel version... it is a lost cause to argue one way or another... - Arnaud