From owner-freebsd-net@FreeBSD.ORG Thu Dec 6 16:48:54 2012 Return-Path: Delivered-To: freebsd-net@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F003027B for ; Thu, 6 Dec 2012 16:48:54 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) by mx1.freebsd.org (Postfix) with ESMTP id 6F16F8FC12 for ; Thu, 6 Dec 2012 16:48:53 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id qB6Gmp0J061126; Thu, 6 Dec 2012 20:48:51 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id qB6Gmn4g061125; Thu, 6 Dec 2012 20:48:49 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 6 Dec 2012 20:48:49 +0400 From: Gleb Smirnoff To: Kevin Lo Subject: Re: Review request: fix return value of socket(2) on no family found Message-ID: <20121206164849.GE48639@FreeBSD.org> References: <50C03D8F.3090106@kevlo.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <50C03D8F.3090106@kevlo.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-net@FreeBSD.org X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2012 16:48:55 -0000 Kevin, On Thu, Dec 06, 2012 at 02:39:11PM +0800, Kevin Lo wrote: K> Here's the patch mostly from NetBSD to make socket(2) return EAFNOSUPPORT K> rather than EPROTONOSUPPORT if the family cannot be found. K> K> http://people.freebsd.org/~kevlo/patch-socket K> K> The man page documents the behavior specified in POSIX.1-2008: K> K> http://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html K> K> For reference, Linux, NetBSD, and OS X return EAFNOSUPPORT for this. IMO, the proposed change is correct. I'd suggest only couple of things: - Please commit the addition of the pffinddomain() function and its documentation separately from socket() return value change. - May be it is worth to have a comment with reference to POSIX in the code in uipc_socket.c, that selects approptiate error value. -- Totus tuus, Glebius.