On 08.02.2014, at 18:16, Andreas Färber <afaer...@suse.de> wrote:

> Am 08.02.2014 05:40, schrieb Fam Zheng:
>> This adds parameter "argv0" in calling path from main() to
>> module_call_init(). So that module loader knows the location of
>> executable.
>> 
>> Suggested-by: Paolo Bonzini <pbonz...@redhat.com>
>> Signed-off-by: Fam Zheng <f...@redhat.com>
> [...]
>> diff --git a/bsd-user/main.c b/bsd-user/main.c
>> index f9246aa..2802d0c 100644
>> --- a/bsd-user/main.c
>> +++ b/bsd-user/main.c
>> @@ -749,7 +749,7 @@ int main(int argc, char **argv)
>>     if (argc <= 1)
>>         usage();
>> 
>> -    module_call_init(MODULE_INIT_QOM);
>> +    module_call_init(MODULE_INIT_QOM, argv[0]);
>> 
>>     if ((envlist = envlist_create()) == NULL) {
>>         (void) fprintf(stderr, "Unable to allocate envlist\n");
> [...]
>> diff --git a/linux-user/main.c b/linux-user/main.c
>> index cabc9e1..b01c0a9 100644
>> --- a/linux-user/main.c
>> +++ b/linux-user/main.c
>> @@ -3805,7 +3805,7 @@ int main(int argc, char **argv, char **envp)
>>     int ret;
>>     int execfd;
>> 
>> -    module_call_init(MODULE_INIT_QOM);
>> +    module_call_init(MODULE_INIT_QOM, argv0);
>> 
>>     qemu_init_auxval(envp);
>>     qemu_cache_utils_init();
> 
> Are you sure these two are going to do the expected thing? At least with
> Alex' binfmt wrapper, argv[0] will be the path of the emulated binary
> (e.g., /bin/ls) rather than QEMU's IIUC. CC'ing Alex and Riku.

argv[0] will still be the QEMU binary, but the wrapper sets the QEMU_ARV0 
environment variable to the real one. So IIUC this change should be ok.


Alex


Reply via email to