* [Qemu-devel] [PATCH] linux-user: make binfmt flag O require P
@ 2014-07-14 18:32 Joakim Tjernlund
2014-07-14 18:39 ` Alexander Graf
0 siblings, 1 reply; 3+ messages in thread
From: Joakim Tjernlund @ 2014-07-14 18:32 UTC (permalink / raw
To: qemu-devel, Riku Voipio, Alexander Graf; +Cc: Joakim Tjernlund
Qemu can autodetect if it is started from Linux binfmt loader
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 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
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 ) {
+ 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 */
+ memmove(&argv[2], &argv[3], (argc-2)*sizeof(argv));
+ 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) {
--
1.8.5.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] linux-user: make binfmt flag O require P
2014-07-14 18:32 [Qemu-devel] [PATCH] linux-user: make binfmt flag O require P Joakim Tjernlund
@ 2014-07-14 18:39 ` Alexander Graf
2014-07-14 18:54 ` Joakim Tjernlund
0 siblings, 1 reply; 3+ messages in thread
From: Alexander Graf @ 2014-07-14 18:39 UTC (permalink / raw
To: Joakim Tjernlund, qemu-devel, Riku Voipio
On 14.07.14 20:32, Joakim Tjernlund wrote:
> Qemu can autodetect if it is started from Linux binfmt loader
> 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>
This is missing the updates to binfmt_misc.sh. Otherwise I think the
patch is good :).
Alex
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] linux-user: make binfmt flag O require P
2014-07-14 18:39 ` Alexander Graf
@ 2014-07-14 18:54 ` Joakim Tjernlund
0 siblings, 0 replies; 3+ messages in thread
From: Joakim Tjernlund @ 2014-07-14 18:54 UTC (permalink / raw
To: Alexander Graf; +Cc: Riku Voipio, qemu-devel
Alexander Graf <agraf@suse.de> wrote on 2014/07/14 20:39:29:
>
> On 14.07.14 20:32, Joakim Tjernlund wrote:
> > Qemu can autodetect if it is started from Linux binfmt loader
> > 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>
>
> This is missing the updates to binfmt_misc.sh. Otherwise I think the
> patch is good :).
>
Sent v2 with that.
Very quiet from Riku, are you there?
Jocke
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-07-14 18:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-14 18:32 [Qemu-devel] [PATCH] linux-user: make binfmt flag O require P Joakim Tjernlund
2014-07-14 18:39 ` Alexander Graf
2014-07-14 18:54 ` Joakim Tjernlund
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.