[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 06/15] linux-user: Replace bprm->fd with bprm->src.fd
From: |
Richard Henderson |
Subject: |
[PATCH v3 06/15] linux-user: Replace bprm->fd with bprm->src.fd |
Date: |
Fri, 11 Aug 2023 09:50:43 -0700 |
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 311d20f5d1..5b4cdddd50 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 8f5e9f489b..15e3ec5f6b 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
- [PATCH v3 00/15] linux-user: Implement VDSOs, Richard Henderson, 2023/08/11
- [PATCH v3 01/15] linux-user: Introduce imgsrc_read, imgsrc_read_alloc, Richard Henderson, 2023/08/11
- [PATCH v3 02/15] linux-user: Tidy loader_exec, Richard Henderson, 2023/08/11
- [PATCH v3 03/15] linux-user: Do not clobber bprm_buf swapping ehdr, Richard Henderson, 2023/08/11
- [PATCH v3 05/15] linux-user: Use ImageSource in load_symbols, Richard Henderson, 2023/08/11
- [PATCH v3 07/15] linux-user: Load vdso image if available, Richard Henderson, 2023/08/11
- [PATCH v3 06/15] linux-user: Replace bprm->fd with bprm->src.fd,
Richard Henderson <=
- [PATCH v3 04/15] linux-user: Use ImageSource in load_elf_image, Richard Henderson, 2023/08/11
- [PATCH v3 12/15] linux-user/hppa: Add vdso and use it for rt_sigreturn, Richard Henderson, 2023/08/11
- [PATCH v3 08/15] linux-user: Add gen-vdso tool, Richard Henderson, 2023/08/11
- [PATCH v3 09/15] linux-user/aarch64: Add vdso and use it for rt_sigreturn, Richard Henderson, 2023/08/11
- [PATCH v3 10/15] target/arm: Add isar_feature_aa32_a32, Richard Henderson, 2023/08/11
- [PATCH v3 13/15] linux-user/i386: Add vdso and use it for sigreturn, Richard Henderson, 2023/08/11
- [PATCH v3 14/15] linux-user/x86_64: Add vdso, Richard Henderson, 2023/08/11
- [PATCH v3 15/15] linux-user/riscv: Add vdso and use it for sigreturn, Richard Henderson, 2023/08/11
- [PATCH v3 11/15] linux-user/arm: Add vdso and use it for rt_sigreturn, Richard Henderson, 2023/08/11
- Re: [PATCH v3 00/15] linux-user: Implement VDSOs, Alex Bennée, 2023/08/14