Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Jan 2011 08:36:01 -0500
From:      Andrew Gallatin <gallatin@gmail.com>
To:        Alexander Leidinger <Alexander@leidinger.net>
Cc:        freebsd-multimedia@freebsd.org, emulation@freebsd.org, Juergen Lock <nox@jelal.kn-bremen.de>
Subject:   Re: FYI: v4l-linuxulator support in FreeBSD-current now
Message-ID:  <AANLkTi=82kZ23vf0zSur1RfMJFfPFzQmt3VeBKgjw=xR@mail.gmail.com>
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> <AANLkTi=Ek4-C5LJtoxo7bTHr8Zn=_QBJfJeXE5Ybk2g-@mail.gmail.com> <20110111160907.454c74d7@shibato.opal.com> <20110111222055.GA44727@triton8.kn-bremen.de> <20110112110840.157527pfroeph9xc@webmail.leidinger.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jan 12, 2011 at 5:08 AM, Alexander Leidinger
<Alexander@leidinger.net> wrote:
> Quoting Juergen Lock <nox@jelal.kn-bremen.de> (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 <stdio.h>
#include <sys/ioctl.h>

main()
{
        printf("IOC_DIRSHIFT=3D%d, IOW=3D%lx  IOR=3D%lx\n", _IOC_DIRSHIFT,
_IOW(0, 0, int), _IOR(0, 0, int));
}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTi=82kZ23vf0zSur1RfMJFfPFzQmt3VeBKgjw=xR>