qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2] linux-user: make binfmt flag O require P


From: Joakim Tjernlund
Subject: Re: [Qemu-devel] [PATCH v2] linux-user: make binfmt flag O require P
Date: Mon, 14 Jul 2014 23:04:52 +0200

Andreas Färber <address@hidden> wrote on 2014/07/14 22:14:25:
> Am 14.07.2014 20:52, schrieb Joakim Tjernlund:
> > Qemu can autodetect if it is started from Linux binfmt loader
> 
> "QEMU"
> 
> > when binfmt flag O is on.
> > Use that and require binfmt flag P as well which will enable QEMU
> > to pass in correct argv0 to the application.
> > 
> > Signed-off-by: Joakim Tjernlund <address@hidden>
> > ---
> >  linux-user/main.c           | 13 ++++++++++++-
> >  scripts/qemu-binfmt-conf.sh | 36 ++++++++++++++++++------------------
> >  2 files changed, 30 insertions(+), 19 deletions(-)
> > 
> > diff --git a/linux-user/main.c b/linux-user/main.c
> > index 71a33c7..9736768 100644
> > --- a/linux-user/main.c
> > +++ b/linux-user/main.c
> > @@ -3829,6 +3829,18 @@ int main(int argc, char **argv, char **envp)
> >      int ret;
> >      int execfd;
> > 
> > +    execfd = qemu_getauxval(AT_EXECFD);
> > +    if (execfd > 0 ) {
> 
> Still one superfluous trailing space.
> 
> > +        if (argc < 3) {
> > +            fprintf(stderr, "%s: Please use me through binfmt with P 
flag\n",
> > +                    argv[0]);
> > +            exit(1);
> > +        }
> > +        handle_arg_argv0(argv[2]); /* binfmt wrapper */
> 
> We might as well inline this for clarity, to distinguish from -0 /
> QEMU_ARGV0 handling:
> 
> argv0 = strdup(argv[2]);
> 
> Also, what is the "binfmt wrapper" comment supposed to say here? Either
> extend it, move it or drop it.
> 
> > +        memmove(&argv[2], &argv[3], (argc-2)*sizeof(argv));
> 
> Still missing spaces around * and - operators.
> 
> Why do we need to modify argv[] here when we are building a
> target_argv[] further down anyway?

Because parse_opts() will not do it for me and I cannot figure out how to 
modify
parse_opts() whithout breaking it.



reply via email to

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