On 8 February 2014 23:36, Paolo Bonzini <pbonz...@redhat.com> wrote: > Il 08/02/2014 18:46, Peter Maydell ha scritto: >> 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.
That's why we call os_find_datadir exactly once. That we're doing the lookup on each call to module_load is kind of what I'm suggesting is wrong... > 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? 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. thanks -- PMM