qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: alex.bennee@linaro.org, laurent@vivier.eu,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: [PATCH v6 06/19] linux-user: Replace bprm->fd with bprm->src.fd
Date: Fri, 29 Sep 2023 19:15:16 -0700	[thread overview]
Message-ID: <20230930021529.987950-7-richard.henderson@linaro.org> (raw)
In-Reply-To: <20230930021529.987950-1-richard.henderson@linaro.org>

There are only a couple of uses of bprm->fd remaining.
Migrate to the other field.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/loader.h    | 1 -
 linux-user/flatload.c  | 8 ++++----
 linux-user/linuxload.c | 5 ++---
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/linux-user/loader.h b/linux-user/loader.h
index da6591fff0..a0834290e7 100644
--- a/linux-user/loader.h
+++ b/linux-user/loader.h
@@ -74,7 +74,6 @@ struct linux_binprm {
     char buf[BPRM_BUF_SIZE] __attribute__((aligned));
     ImageSource src;
     abi_ulong p;
-    int fd;
     int e_uid, e_gid;
     int argc, envc;
     char **argv;
diff --git a/linux-user/flatload.c b/linux-user/flatload.c
index 4331a11bf0..0811f32aaf 100644
--- a/linux-user/flatload.c
+++ b/linux-user/flatload.c
@@ -463,7 +463,7 @@ static int load_flat_file(struct linux_binprm * bprm,
         DBG_FLT("BINFMT_FLAT: ROM mapping of file (we hope)\n");
 
         textpos = target_mmap(0, text_len, PROT_READ|PROT_EXEC,
-                              MAP_PRIVATE, bprm->fd, 0);
+                              MAP_PRIVATE, bprm->src.fd, 0);
         if (textpos == -1) {
             fprintf(stderr, "Unable to mmap process text\n");
             return -1;
@@ -490,7 +490,7 @@ static int load_flat_file(struct linux_binprm * bprm,
         } else
 #endif
         {
-            result = target_pread(bprm->fd, datapos,
+            result = target_pread(bprm->src.fd, datapos,
                                   data_len + (relocs * sizeof(abi_ulong)),
                                   fpos);
         }
@@ -540,10 +540,10 @@ static int load_flat_file(struct linux_binprm * bprm,
         else
 #endif
         {
-            result = target_pread(bprm->fd, textpos,
+            result = target_pread(bprm->src.fd, textpos,
                                   text_len, 0);
             if (result >= 0) {
-                result = target_pread(bprm->fd, datapos,
+                result = target_pread(bprm->src.fd, datapos,
                     data_len + (relocs * sizeof(abi_ulong)),
                     ntohl(hdr->data_start));
             }
diff --git a/linux-user/linuxload.c b/linux-user/linuxload.c
index 5b7e9ab983..4a794f8cea 100644
--- a/linux-user/linuxload.c
+++ b/linux-user/linuxload.c
@@ -39,7 +39,7 @@ static int prepare_binprm(struct linux_binprm *bprm)
     int mode;
     int retval;
 
-    if (fstat(bprm->fd, &st) < 0) {
+    if (fstat(bprm->src.fd, &st) < 0) {
         return -errno;
     }
 
@@ -69,7 +69,7 @@ static int prepare_binprm(struct linux_binprm *bprm)
         bprm->e_gid = st.st_gid;
     }
 
-    retval = read(bprm->fd, bprm->buf, BPRM_BUF_SIZE);
+    retval = read(bprm->src.fd, bprm->buf, BPRM_BUF_SIZE);
     if (retval < 0) {
         perror("prepare_binprm");
         exit(-1);
@@ -144,7 +144,6 @@ int loader_exec(int fdexec, const char *filename, char **argv, char **envp,
 {
     int retval;
 
-    bprm->fd = fdexec;
     bprm->src.fd = fdexec;
     bprm->filename = (char *)filename;
     bprm->argc = count(argv);
-- 
2.34.1



  parent reply	other threads:[~2023-09-30  2:17 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-30  2:15 [PATCH v6 00/19] linux-user: Implement VDSOs Richard Henderson
2023-09-30  2:15 ` [PATCH v6 01/19] linux-user: Introduce imgsrc_read, imgsrc_read_alloc Richard Henderson
2023-09-30  2:15 ` [PATCH v6 02/19] linux-user: Tidy loader_exec Richard Henderson
2023-09-30  2:15 ` [PATCH v6 03/19] linux-user: Do not clobber bprm_buf swapping ehdr Richard Henderson
2023-09-30  2:15 ` [PATCH v6 04/19] linux-user: Use ImageSource in load_elf_image Richard Henderson
2023-10-02 13:22   ` Philippe Mathieu-Daudé
2023-09-30  2:15 ` [PATCH v6 05/19] linux-user: Use ImageSource in load_symbols Richard Henderson
2023-09-30  2:15 ` Richard Henderson [this message]
2023-09-30  2:15 ` [PATCH v6 07/19] linux-user: Load vdso image if available Richard Henderson
2023-10-03 12:47   ` Philippe Mathieu-Daudé
2023-09-30  2:15 ` [PATCH v6 08/19] linux-user: Add gen-vdso tool Richard Henderson
2023-10-03 13:00   ` Philippe Mathieu-Daudé
2023-10-03 23:05     ` Richard Henderson
2023-10-05 16:25       ` Philippe Mathieu-Daudé
2023-09-30  2:15 ` [PATCH v6 09/19] linux-user/i386: Add vdso Richard Henderson
2023-10-05 16:42   ` Philippe Mathieu-Daudé
2023-09-30  2:15 ` [PATCH v6 10/19] linux-user/x86_64: " Richard Henderson
2023-10-05 16:44   ` Philippe Mathieu-Daudé
2023-09-30  2:15 ` [PATCH v6 11/19] linux-user/aarch64: " Richard Henderson
2023-10-05 16:47   ` Philippe Mathieu-Daudé
2023-09-30  2:15 ` [PATCH v6 12/19] linux-user/arm: " Richard Henderson
2023-09-30  2:15 ` [PATCH v6 13/19] linux-user/hppa: " Richard Henderson
2023-10-05 16:16   ` Philippe Mathieu-Daudé
2023-09-30  2:15 ` [PATCH v6 14/19] linux-user/riscv: " Richard Henderson
2023-10-05 16:24   ` Philippe Mathieu-Daudé
2023-09-30  2:15 ` [PATCH v6 15/19] linux-user/loongarch64: " Richard Henderson
2023-10-05 16:18   ` Philippe Mathieu-Daudé
2023-09-30  2:15 ` [PATCH v6 16/19] linux-user/ppc: " Richard Henderson
2023-10-05 16:35   ` Philippe Mathieu-Daudé
2023-09-30  2:15 ` [PATCH v6 17/19] linux-user/s390x: Rename __SIGNAL_FRAMESIZE to STACK_FRAME_OVERHEAD Richard Henderson
2023-09-30  2:15 ` [PATCH v6 18/19] linux-user/s390x: Add vdso Richard Henderson
2023-10-03 13:07   ` Philippe Mathieu-Daudé
2023-10-03 23:01     ` Richard Henderson
2023-10-05 16:14       ` Philippe Mathieu-Daudé
2023-10-06  7:30         ` Thomas Huth
2023-09-30  2:15 ` [PATCH v6 19/19] build: Add update-linux-vdso makefile rule Richard Henderson
2023-10-03 13:02   ` Philippe Mathieu-Daudé

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=20230930021529.987950-7-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=f4bug@amsat.org \
    --cc=laurent@vivier.eu \
    --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).