From owner-freebsd-emulation@freebsd.org Sat Sep 26 21:03:43 2015 Return-Path: Delivered-To: freebsd-emulation@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C8B51A0A01B for ; Sat, 26 Sep 2015 21:03:43 +0000 (UTC) (envelope-from lobo@bsd.com.br) Received: from mail-qg0-x234.google.com (mail-qg0-x234.google.com [IPv6:2607:f8b0:400d:c04::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 86A8C902 for ; Sat, 26 Sep 2015 21:03:43 +0000 (UTC) (envelope-from lobo@bsd.com.br) Received: by qgt47 with SMTP id 47so94465175qgt.2 for ; Sat, 26 Sep 2015 14:03:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsd.com.br; s=capeta; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-type:content-transfer-encoding; bh=yiy7OJQggv2OAe3oYvsjtqIRgNF/yHc28bjVIVJwvlg=; b=PPp12oaCHa1EdWbqaUHihZ6SQOC0e4lJRpKr4eZ+5iI1yTw9sX1macXrJj7vtbjsK/ sZ9I2jL4wYT5DSu5cDF9jzYVbofLKYXM2vo1zd9M+AvjvePDZcuXwgrIIvoq+ZZEjpTT 2lY4WSK5dlPYX1BpL/w0e74ej8lmPXWEV0bcY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-type :content-transfer-encoding; bh=yiy7OJQggv2OAe3oYvsjtqIRgNF/yHc28bjVIVJwvlg=; b=my+iIT/AGfwGv6e+ek2lLjXYtEZ2cSqFrFPxXj0V9px5KB4hyN847RHfaIUtfBLS54 jqRsOje1auVCAKDrDYRIEi0FH0+AGi6RgLd8n3aLXaKCbKiPwUIL25N3CV88h+4UMWuG rKEAgEFeqZ8JrNaJRtZzCP3JLVjtWIM2hrJTV7IPxYts9cwfS7Eh/xOKDyLRWjJYoO7K RiUeOrU40U80UY5aIoNk3pcb9avBY3yON9FFZMlBZ1Y/wJqjij09bbwV9AtRT8ANqmrD naca+eyCgz/fsjfqZRcxC/VqZ+OdZDfHBQiTbzMCInELGCUCj0gGVV04CSK3+q1dMn7+ p69w== X-Gm-Message-State: ALoCoQm9F9vg6GX3QE4OgDaBbgjb0D6t/gEAZV/fC5IJQNa+AFzVzMGgi9zAB/RESEXksGR2Lrzj X-Received: by 10.140.194.148 with SMTP id p142mr14761756qha.84.1443301422140; Sat, 26 Sep 2015 14:03:42 -0700 (PDT) Received: from Papi ([177.135.59.144]) by smtp.gmail.com with ESMTPSA id 142sm4031932qhg.13.2015.09.26.14.03.40 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 26 Sep 2015 14:03:41 -0700 (PDT) Date: Sat, 26 Sep 2015 18:08:26 -0300 From: Mario Lobo To: Alexander Leidinger Cc: freebsd-emulation@freebsd.org Subject: Re: /dev for Linux binaries in freebsd Message-ID: <20150926180826.5d673a64@Papi> In-Reply-To: <20150926134433.Horde.dywx79dLiTk9Z_UmyvgIU7-@webmail.leidinger.net> References: <20150924195443.1805e50d@Papi> <20150926134433.Horde.dywx79dLiTk9Z_UmyvgIU7-@webmail.leidinger.net> Organization: BSD X-Mailer: Claws Mail 3.12.0 (GTK+ 2.24.25; amd64-portbld-freebsd10.2) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.20 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, 26 Sep 2015 21:03:44 -0000 On Sat, 26 Sep 2015 13:44:33 +0200 Alexander Leidinger wrote: > Quoting Mario Lobo (from Thu, 24 Sep 2015 19:54:43 > -0300): > > > I was trying to find out where a linux binary will look for the /dev > > directory. > > > > I tried to link the device I need to /compat/linux/dev but that > > didn't work. > > This is expected. Do not create links to the real /dev there, you > will create a loop (see below). > > > How can a linux binary see the devices (serial ports, usb, etc) of > > the system? > > The behavior under the assumption that you haven't chrooted into > /compat/linux is: > > A linux program will ask the kernel for /dev/xyz. > The kernel knows that it is a linux program, and as such it will > first look for /compat/linux/dev/xyz. > If the kernel doesn't find the device there, it will look > for /dev/xyz. > > As such you should not touch /compat/linux/dev at all, it will > "fall-through" to the real /dev. > > Maybe your real problem is not that you can't access the right /dev/ > entry, but that the devide doesn't understand what the linux program > wants to do. > > You can use ktrace or dtrace to check what the program tries to do. > You should see in the output what the real patch is it tries to > reach and what kind or errno it get's when it tries to access it. > > > If you chroot into /compat/linux, you need to mount devfs in > additionally to /compat/linux/dev. > > Bye, > Alexander. Thanks for the tips, Alexander. I`ll see what I can find out. -- Mario Lobo http://www.mallavoodoo.com.br FreeBSD since 2.2.8 [not Pro-Audio.... YET!!] "UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things."