Commit fd4d81dd04b4e606ce40a41d66368ba77c77c753

Authored by Arnaud Patard
Committed by Riku Voipio
1 parent e8d2a887

linux-user: increment MAX_ARG_PAGES

There's a error When doing something like that :
find / -type f -print0 | xargs -0 echo

[ done in a arm chroot with qemu-arm and linux binfmt stuff or with
find / -type f -print0 | qemu-arm -L <path> <path>/usr/bin/xargs -0
echo ]

Doing this outsite qemu is fine. The problem was the huge number of
parameters. Increasing MAX_ARG_PAGES is fixing that.

While I was at it, I've modified linux-user/main.c to report error code
of loader_exec. It helps to debug/know what's wrong.

Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
linux-user/main.c
... ... @@ -2372,6 +2372,7 @@ int main(int argc, char **argv, char **envp)
2372 2372 envlist_t *envlist = NULL;
2373 2373 const char *argv0 = NULL;
2374 2374 int i;
  2375 + int ret;
2375 2376  
2376 2377 if (argc <= 1)
2377 2378 usage();
... ... @@ -2576,9 +2577,10 @@ int main(int argc, char **argv, char **envp)
2576 2577 env->opaque = ts;
2577 2578 task_settid(ts);
2578 2579  
2579   - if (loader_exec(filename, target_argv, target_environ, regs,
2580   - info, &bprm) != 0) {
2581   - printf("Error loading %s\n", filename);
  2580 + ret = loader_exec(filename, target_argv, target_environ, regs,
  2581 + info, &bprm);
  2582 + if (ret != 0) {
  2583 + printf("Error %d while loading %s\n", ret, filename);
2582 2584 _exit(1);
2583 2585 }
2584 2586  
... ...
linux-user/qemu.h
... ... @@ -140,7 +140,7 @@ extern const char *qemu_uname_release;
140 140 * and envelope for the new program. 32 should suffice, this gives
141 141 * a maximum env+arg of 128kB w/4KB pages!
142 142 */
143   -#define MAX_ARG_PAGES 32
  143 +#define MAX_ARG_PAGES 33
144 144  
145 145 /*
146 146 * This structure is used to hold the arguments that are
... ...