From owner-freebsd-multimedia@FreeBSD.ORG Wed Jan 12 13:36:03 2011 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78E881065674; Wed, 12 Jan 2011 13:36:03 +0000 (UTC) (envelope-from gallatin@gmail.com) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id 18E418FC12; Wed, 12 Jan 2011 13:36:02 +0000 (UTC) Received: by ywp6 with SMTP id 6so213752ywp.13 for ; Wed, 12 Jan 2011 05:36:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=9pkRt2d9hMOk4WeOnhDJlL85jHK2cwuxHAFgBQCBMTs=; b=BEa3KkjNq6ifOMLMccwrZ0Fz2brHVTa8cDzpdDSKs9X2DatM7/PPc8117DUslMWhzJ 5DVMbNgmKYM7wRSzzMgS1GXgRXepV2NTyisVNwIgG3oCUH/NPmBWfq4pxyUmA/qWycg3 WFdJ5iSBJ56+QjHnQ4pNcADR9DcNv1FAmmeS4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=J/MpbHFC+z6+/ptTNvfzzgB2fZdWDg9iF2L2n10drYNjKQ7JY3/N39GDgEeNhF/9Fk 4EoVRtnzEdIN2tOd8H8/6dZ2IebQsDdyU8ePgqjFRNhf1BXQ4Gwob/TN8QvTTBsWr8Pb jGmEfJUZmmkoouDjLMpE/4M9c1npyI87c4P30= MIME-Version: 1.0 Received: by 10.100.173.18 with SMTP id v18mr616760ane.58.1294839362013; Wed, 12 Jan 2011 05:36:02 -0800 (PST) Received: by 10.100.248.15 with HTTP; Wed, 12 Jan 2011 05:36:01 -0800 (PST) In-Reply-To: <20110112110840.157527pfroeph9xc@webmail.leidinger.net> References: <20091204223126.00005392@unknown> <201001081650.14189.hselasky@c2i.net> <20100108114130.1cfe88c5@shibato.opal.com> <201101110947.46399.hselasky@c2i.net> <20110111092609.7bf82016@shibato.opal.com> <20110111183937.GA36761@triton8.kn-bremen.de> <20110111160907.454c74d7@shibato.opal.com> <20110111222055.GA44727@triton8.kn-bremen.de> <20110112110840.157527pfroeph9xc@webmail.leidinger.net> Date: Wed, 12 Jan 2011 08:36:01 -0500 Message-ID: From: Andrew Gallatin To: Alexander Leidinger Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-multimedia@freebsd.org, emulation@freebsd.org, Juergen Lock , "J.R. Oldroyd" Subject: Re: FYI: v4l-linuxulator support in FreeBSD-current now X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jan 2011 13:36:03 -0000 On Wed, Jan 12, 2011 at 5:08 AM, Alexander Leidinger wrote: > Quoting Juergen Lock (from Tue, 11 Jan 2011 > 23:20:55 +0100): > >> =A0But anyway if you want to merge this version as it is now you want >> it at least to return errors for the ioctls it doesn't translate, >> or only do that on amd64. >> >> =A0(Or maybe I'll look at this over the weekend myself but I can't >> promise anything... :) > > So if it is just two ioctl's to cover: Andrew, do your applications still > work =A0when those ioctl's return ENOSYS or an error (whatever is more > sensible in this case)? If yes, I would not complain if those ioctl's wou= ld > return ENOSYS (and do some sensible rate limited logging explaining the > issue) in the linux32 on amd64 case but work on i386 (in case nobody has = the > time to make them work correctly in linux32 on amd64). You guys are too fast for me. I haven't had time to actually install the intended application (SageTV) and its pre-reqs yet. > One question still remains, why is the bitswap required? Is it really tha= t > linux uses a different order than FreeBSD and all the other code does it > somehow implicitely (and I didn't notice it), or is there something else > going on? IMO this is an important question to answer before a commit. This confused me too, so I wrote a toy program & compiled it on linux (program appended). The output it gives is on linux is: IOC_DIRSHIFT=3D30, IOW=3D40040000 IOR=3D80040000 Looking at the FreeBSD ioctl defines in sys/ioccom.h #define IOC_OUT 0x40000000 /* copy out parameters */ #define IOC_IN 0x80000000 /* copy in parameters */ #define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t)) #define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t)) So it does seem that IOR / IOW are reversed in FreeBSD & Linux. Not sure why this has never been an issue before. Drew #include #include main() { printf("IOC_DIRSHIFT=3D%d, IOW=3D%lx IOR=3D%lx\n", _IOC_DIRSHIFT, _IOW(0, 0, int), _IOR(0, 0, int)); }