Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 May 2009 20:36:07 +0400
From:      Chagin Dmitry <dchagin@freebsd.org>
To:        Robert Watson <rwatson@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r191742 - head/sys/compat/linux
Message-ID:  <20090503163607.GA30330@dchagin.static.corbina.ru>
In-Reply-To: <alpine.BSF.2.00.0905030442320.41143@fledge.watson.org>
References:  <200905021051.n42ApetI083033@svn.freebsd.org> <alpine.BSF.2.00.0905030442320.41143@fledge.watson.org>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On Sun, May 03, 2009 at 04:57:03AM +0100, Robert Watson wrote:
> 
> 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) 

domain argument is mapped,
I used value AF_LOCAL which is similar to the value
of localdomain .dom_family member. It misleads :)

> 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.
> 

agree. I send a new patch to the mentor. Thank you!

-- 
Have fun!
chd

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (FreeBSD)

iEYEARECAAYFAkn9x/cACgkQ0t2Tb3OO/O0d2ACgvGszDvbZhoVUCMQsTw+Umcdv
3l8AoL5kU8Njsjy3o+sDzXNrLO3YOHvh
=Ty+m
-----END PGP SIGNATURE-----

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