From: Richard Henderson <rth@twiddle.net>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org
Subject: [Qemu-devel] [PATCH v3 6/6] linux-user: Use qemu_getauxval for AT_EXECFD
Date: Thu, 17 Oct 2013 08:29:41 -0700 [thread overview]
Message-ID: <1382023781-26323-7-git-send-email-rth@twiddle.net> (raw)
In-Reply-To: <1382023781-26323-1-git-send-email-rth@twiddle.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
linux-user/main.c | 32 ++++++--------------------------
1 file changed, 6 insertions(+), 26 deletions(-)
diff --git a/linux-user/main.c b/linux-user/main.c
index 50db755..54f71fe 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -3663,26 +3663,6 @@ static int parse_args(int argc, char **argv)
return optind;
}
-static int get_execfd(char **envp)
-{
- typedef struct {
- long a_type;
- long a_val;
- } auxv_t;
- auxv_t *auxv;
-
- while (*envp++ != NULL) {
- ;
- }
-
- for (auxv = (auxv_t *)envp; auxv->a_type != AT_NULL; auxv++) {
- if (auxv->a_type == AT_EXECFD) {
- return auxv->a_val;
- }
- }
- return -1;
-}
-
int main(int argc, char **argv, char **envp)
{
struct target_pt_regs regs1, *regs = ®s1;
@@ -3876,13 +3856,13 @@ int main(int argc, char **argv, char **envp)
env->opaque = ts;
task_settid(ts);
- execfd = get_execfd(envp);
- if (execfd < 0) {
+ execfd = qemu_getauxval(AT_EXECFD);
+ if (execfd == 0) {
execfd = open(filename, O_RDONLY);
- }
- if (execfd < 0) {
- printf("Error while loading %s: %s\n", filename, strerror(-execfd));
- _exit(1);
+ if (execfd < 0) {
+ printf("Error while loading %s: %s\n", filename, strerror(errno));
+ _exit(1);
+ }
}
ret = loader_exec(execfd, filename, target_argv, target_environ, regs,
--
1.8.3.1
next prev parent reply other threads:[~2013-10-17 15:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-17 15:29 [Qemu-devel] [PATCH v3 0/6] Improve getauxval support Richard Henderson
2013-10-17 15:29 ` [Qemu-devel] [PATCH v3 1/6] osdep: Create qemu_getauxval and qemu_init_auxval Richard Henderson
2013-10-17 15:33 ` Peter Maydell
2013-10-17 15:29 ` [Qemu-devel] [PATCH v3 2/6] tcg-ppc64: Use qemu_getauxval Richard Henderson
2013-10-17 15:29 ` [Qemu-devel] [PATCH v3 3/6] tcg-arm: " Richard Henderson
2013-11-29 11:29 ` Peter Maydell
2013-10-17 15:29 ` [Qemu-devel] [PATCH v3 4/6] tcg-s390: Use qemu_getauxval in query_facilities Richard Henderson
2013-10-17 15:29 ` [Qemu-devel] [PATCH v3 5/6] util: Use qemu_getauxval in linux qemu_cache_utils_init Richard Henderson
2013-10-17 15:29 ` Richard Henderson [this message]
2013-10-17 15:33 ` [Qemu-devel] [PATCH v3 6/6] linux-user: Use qemu_getauxval for AT_EXECFD Peter Maydell
2013-10-28 17:30 ` [Qemu-devel] [PATCH v3 0/6] Improve getauxval support Richard Henderson
2013-11-19 6:58 ` Richard Henderson
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=1382023781-26323-7-git-send-email-rth@twiddle.net \
--to=rth@twiddle.net \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).