From: "Andreas Färber" <afaerber@suse.de>
To: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>,
qemu-devel@nongnu.org, Alexander Graf <agraf@suse.de>
Cc: Riku Voipio <riku.voipio@iki.fi>
Subject: Re: [Qemu-devel] [PATCH v2] linux-user: make binfmt flag O require P
Date: Mon, 14 Jul 2014 22:14:25 +0200 [thread overview]
Message-ID: <53C43A21.1090907@suse.de> (raw)
In-Reply-To: <1405363942-6865-1-git-send-email-Joakim.Tjernlund@transmode.se>
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 <Joakim.Tjernlund@transmode.se>
> ---
> 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?
> + argc--;
> + }
> +
> module_call_init(MODULE_INIT_QOM);
>
> if ((envlist = envlist_create()) == NULL) {
> @@ -4003,7 +4015,6 @@ int main(int argc, char **argv, char **envp)
> cpu->opaque = ts;
> task_settid(ts);
>
> - execfd = qemu_getauxval(AT_EXECFD);
> if (execfd == 0) {
> execfd = open(filename, O_RDONLY);
> if (execfd < 0) {
[snip]
Regards,
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
next prev parent reply other threads:[~2014-07-14 20:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-14 18:52 [Qemu-devel] [PATCH v2] linux-user: make binfmt flag O require P Joakim Tjernlund
2014-07-14 20:14 ` Andreas Färber [this message]
2014-07-14 21:04 ` Joakim Tjernlund
[not found] ` <OF30E90EA6.DEDD2AF2-ONC1257D15.00739A57-C1257D15.0073CD26@LocalDomain>
2014-07-14 21:37 ` Joakim Tjernlund
2014-07-15 12:02 ` Alexander Graf
2014-07-15 13:20 ` Riku Voipio
2014-07-15 13:21 ` Alexander Graf
2014-07-15 13:45 ` Joakim Tjernlund
[not found] ` <OF10AA8325.4F4D7EC2-ONC1257D15.00769332-C1257D15.0076BF68@LocalDomain>
2014-07-14 22:14 ` Joakim Tjernlund
-- strict thread matches above, loose matches on Subject: below --
2014-07-15 13:46 Joakim Tjernlund
2014-08-11 16:54 ` Joakim Tjernlund
2014-08-12 7:30 ` Riku Voipio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53C43A21.1090907@suse.de \
--to=afaerber@suse.de \
--cc=Joakim.Tjernlund@transmode.se \
--cc=agraf@suse.de \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.