Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Aug 2013 11:21:22 +0200
From:      Hans Petter Selasky <hps@bitfrost.no>
To:        Damjan Jovanovic <damjan.jov@gmail.com>
Cc:        freebsd-usb@freebsd.org
Subject:   Re: COMPAT_32BIT libusb ABI problem
Message-ID:  <5208A912.2050002@bitfrost.no>
In-Reply-To: <CAJm2B-mfidBre0tCwJg=6OirBtdgvxCTrGGVX-3kqQ8vYf1kFw@mail.gmail.com>
References:  <CAJm2B-mfidBre0tCwJg=6OirBtdgvxCTrGGVX-3kqQ8vYf1kFw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 07/24/13 22:09, Damjan Jovanovic wrote:
> Hi
>
> The ioctl:
> #define USB_FS_INIT             _IOW ('U', 195, struct usb_fs_init)
> when used by a COMPAT_32BIT libusb on amd64, fails (causing
> libusb_open() to fail) due to:
>
> freebsd32_ioctl(0x6,0x800c55c3,0xffffc710,0x0,0x0,0x0) ERR#25
> 'Inappropriate ioctl for device'
> but when hacked a bit:
> freebsd32_ioctl(0x6,0x801055c3,0xffffc710,0x0,0x0,0x0) = 0 (0x0)
>
> because sizeof(struct usb_fs_init) is 12 bytes on i386, and 16 bytes on amd64.
>
> But the failure of even libusb_open() - a fundamental libusb function
> - must mean that the COMPAT_32BIT libusb never worked. Can we please
> take this opportunity to kill it and do a real 32 bit compatibility
> layer in the kernel that will work from 32 bit chroots and statically
> linked 32 bit binaries? I'll help.

Hi,

Some further analysis shows that this is due to structures being aligned 
to their biggest element on AMD64 while on I386 not. This should now be 
fixed. Please see the following commit:

http://svnweb.freebsd.org/changeset/base/254243

You will need to use the LibUSB-32 built by the 64-bit system build, and 
not the I386 one, which has COMPAT_32BIT set.

Thank you!

--HPS




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