From owner-freebsd-emulation@FreeBSD.ORG Sat Oct 25 12:16:39 2008 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0157F1065679 for ; Sat, 25 Oct 2008 12:16:39 +0000 (UTC) (envelope-from rdivacky@lev.vlakno.cz) Received: from vlakno.cz (77-93-215-190.static.masterinter.net [77.93.215.190]) by mx1.freebsd.org (Postfix) with ESMTP id B21E78FC1A for ; Sat, 25 Oct 2008 12:16:38 +0000 (UTC) (envelope-from rdivacky@lev.vlakno.cz) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 870189CB33B; Sat, 25 Oct 2008 14:15:42 +0200 (CEST) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by localhost (lev.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XdY-dSxP-q4m; Sat, 25 Oct 2008 14:15:30 +0200 (CEST) Received: from lev.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id A92589CB716; Sat, 25 Oct 2008 14:15:30 +0200 (CEST) Received: (from rdivacky@localhost) by lev.vlakno.cz (8.14.2/8.14.2/Submit) id m9PCFUVB025777; Sat, 25 Oct 2008 14:15:30 +0200 (CEST) (envelope-from rdivacky) Date: Sat, 25 Oct 2008 14:15:30 +0200 From: Roman Divacky To: Martin Laabs Message-ID: <20081025121530.GA25340@freebsd.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: freebsd-emulation@freebsd.org Subject: Re: How to implement a new linuxulator ioctl X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2008 12:16:39 -0000 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