From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49925) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCO9l-0008Qz-Kx for qemu-devel@nongnu.org; Sun, 09 Feb 2014 01:46:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCO9a-000538-SN for qemu-devel@nongnu.org; Sun, 09 Feb 2014 01:46:21 -0500 Received: from mail-ea0-x234.google.com ([2a00:1450:4013:c01::234]:62028) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCO9a-00052y-LL for qemu-devel@nongnu.org; Sun, 09 Feb 2014 01:46:10 -0500 Received: by mail-ea0-f180.google.com with SMTP id o10so2304739eaj.25 for ; Sat, 08 Feb 2014 22:46:09 -0800 (PST) Sender: Paolo Bonzini Message-ID: <52F7242B.3070408@redhat.com> Date: Sun, 09 Feb 2014 07:46:03 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <20140208044003.lMguK8Jj4y2xRi1u%famz@redhat.com> <52F6BF85.8080504@redhat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v19 11/11] module: Pass argv[0] along the module load path List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Kevin Wolf , Fam Zheng , Stefan Hajnoczi , Michael Tokarev , QEMU Developers , Alex Bligh , Miroslav Rezanina , =?UTF-8?B?TGx1w61zIFZpbGFub3Zh?= , Richard Henderson Il 09/02/2014 01:18, Peter Maydell ha scritto: > Haven't checked it yet. I just don't really see what the point is > in having a huge amount of OS specific code to do something > which we already do in a portable way. It might be nice to abstract > out stashing initial-argv0 and adding a utility function for it. > > If we do want to use OS-specific code, then we should be > consistent, ie change the datadir lookup to use it. It is using it already. argv[0] is just a fallback, and Fam's patches moved the OS-specific code of os_find_datadir out of it so that module loading could reuse it. I think there are cases where argv[0] cannot work, such as using the exec system call to invoke QEMU, and specifying a different argv[0] than the actually executed file; or invoking a non-installed QEMU executable by putting its directory in the PATH. They are probably not happening in practice, but they are there. Paolo