How to implement a new linuxulator ioctl

Roman Divacky rdivacky at freebsd.org
Sat Oct 25 12:16:39 UTC 2008


On Sat, Oct 25, 2008 at 12:31:00PM +0200, Martin Laabs wrote:
> Hi,
> 
> as I wrote recently on -hackers I hacked libusb in a 
> way that it is a linux binary but uses the bsd interface
> for low-level usb communication. I need this for a linux binary
> program which uses libusb. I'd like to run this with the 
> linuxulator.
> However - I realized, that the ioctls of the linuxulator are
> wrapped. So I have to add some ioctls to the linuxulator module
> in that way that they are just executed as normal (nativ)
> system ioctls.
> Libusb uses only a small number of different ioctl so that
> it should not be very hard. However I have not found any
> documentation how the ioctl mapping works. (data structures,
> initilisation calls and so on.)
> So can you give me a short guideline what I have to do/add to
> the linuxulator?
> And maybe also how I can call a nativ system ioctl out of
> the kernel context.

take a look at sys/compat/linux/linux_ioctl.c

basically the linux_ioctl() syscall iterates over a set of ioctl
handlers and if one matches (the ioctl number is within its declared
range) it calls that

it's all contained in the file so you should be able to find out
quickly how it works

good luck!

roman


More information about the freebsd-emulation mailing list