From owner-svn-src-all@FreeBSD.ORG Sun May 3 03:57:04 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40A0B1065670; Sun, 3 May 2009 03:57:04 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 1BA388FC0C; Sun, 3 May 2009 03:57:04 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id AF8BF46B58; Sat, 2 May 2009 23:57:03 -0400 (EDT) Date: Sun, 3 May 2009 04:57:03 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Dmitry Chagin In-Reply-To: <200905021051.n42ApetI083033@svn.freebsd.org> Message-ID: References: <200905021051.n42ApetI083033@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r191742 - head/sys/compat/linux X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 May 2009 03:57:04 -0000 On Sat, 2 May 2009, Dmitry Chagin wrote: > Linux socketpair() call expects explicit specified protocol for > AF_LOCAL domain unlike FreeBSD which expects 0 in this case. ... > @@ -859,7 +859,10 @@ linux_socketpair(struct thread *td, stru > return (EINVAL); > > bsd_args.type = args->type; > - bsd_args.protocol = args->protocol; > + if (bsd_args.domain == AF_LOCAL && args->protocol == PF_UNIX) > + bsd_args.protocol = 0; > + else > + bsd_args.protocol = args->protocol; > bsd_args.rsv = (int *)PTRIN(args->rsv); > return (socketpair(td, &bsd_args)); > } I think I'd tweak this to be more like: if (bsd_args.domain == PF_LOCAL) { if (bsd_args.protocol == PF_UNIX) bsd_args.protocl = 0; else if (bsd_args.protocol != 0) return (EPROTONOSUPPORT); } Because (a) the domain argument takes a protocol family in FreeBSD and you're passing arguments into the BSD ABI without a mapping for that field, and (b) for the protocol family the use of PF_UNIX is weird but must be supported, so I'd consider it to be an entirely mapped namespace and avoid passing through values that aren't 0 to the BSD layer as it's not clear what that would mean. Robert N M Watson Computer Laboratory University of Cambridge