FYI: v4l-linuxulator support in FreeBSD-current now
Andrew Gallatin
gallatin at gmail.com
Wed Jan 12 13:36:03 UTC 2011
On Wed, Jan 12, 2011 at 5:08 AM, Alexander Leidinger
<Alexander at leidinger.net> wrote:
> Quoting Juergen Lock <nox at jelal.kn-bremen.de> (from Tue, 11 Jan 2011
> 23:20:55 +0100):
>
>> But 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.
>>
>> (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 when 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 would
> 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 that
> 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=30, IOW=40040000 IOR=80040000
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=%d, IOW=%lx IOR=%lx\n", _IOC_DIRSHIFT,
_IOW(0, 0, int), _IOR(0, 0, int));
}
More information about the freebsd-emulation
mailing list