From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56095) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCHSh-0006Ss-KB for qemu-devel@nongnu.org; Sat, 08 Feb 2014 18:37:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCHSa-0005Vt-7f for qemu-devel@nongnu.org; Sat, 08 Feb 2014 18:37:27 -0500 Received: from mail-ea0-f179.google.com ([209.85.215.179]:38881) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCHSa-0005Vm-11 for qemu-devel@nongnu.org; Sat, 08 Feb 2014 18:37:20 -0500 Received: by mail-ea0-f179.google.com with SMTP id q10so1924953ead.38 for ; Sat, 08 Feb 2014 15:36:44 -0800 (PST) Sender: Paolo Bonzini Message-ID: <52F6BF85.8080504@redhat.com> Date: Sun, 09 Feb 2014 00:36:37 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <20140208044003.lMguK8Jj4y2xRi1u%famz@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 , Fam Zheng Cc: Kevin Wolf , Stefan Hajnoczi , Michael Tokarev , QEMU Developers , Alex Bligh , Miroslav Rezanina , =?UTF-8?B?TGx1w61zIFZpbGFub3Zh?= , Richard Henderson Il 08/02/2014 18:46, Peter Maydell ha scritto: >> This adds parameter "argv0" in calling path from main() to >> > module_call_init(). So that module loader knows the location of >> > executable. > This patch looks kind of odd to me. Why are there so many > different places calling module_call_init() and passing in an > argv0? I would have expected that vl.c (and the equivalent main > functions for the tools) would just initialise the module system > once, passing in the argv0 at that point. I'm ambivalent about this. > It's not obvious why > the block layer should be handing argv0 around through bdrv_init > in order to (re-?) initialise modules. The executable directory is not found once and for all, it's recomputed on any call to module_load or os_find_datadir. But I think this is pointless anyway. The OS knows the executable file name, and the right thing to do is to extend support for finding the executable to all supported OSes. It's a pity that glib doesn't have a function anyway. Peter, does the patch using the Apple-specific function to find the executable work? Paolo