qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v19 11/11] module: Pass argv[0] along the module


From: Alexander Graf
Subject: Re: [Qemu-devel] [PATCH v19 11/11] module: Pass argv[0] along the module load path
Date: Sat, 8 Feb 2014 18:24:24 +0100

On 08.02.2014, at 18:16, Andreas Färber <address@hidden> 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 <address@hidden>
>> Signed-off-by: Fam Zheng <address@hidden>
> [...]
>> 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

[Prev in Thread] Current Thread [Next in Thread]