diff options
author | peter <peter@FreeBSD.org> | 2003-12-23 02:42:39 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2003-12-23 02:42:39 +0000 |
commit | 998b79089fba1b775a2a89f2c6d325d97dd21ead (patch) | |
tree | 1907b96bc90f9f9f4007eae1193fdfe639edb170 /sys/kern/imgact_elf.c | |
parent | 47e1d21299b39eba3b43f8b5986b655cadf52175 (diff) | |
download | FreeBSD-src-998b79089fba1b775a2a89f2c6d325d97dd21ead.zip FreeBSD-src-998b79089fba1b775a2a89f2c6d325d97dd21ead.tar.gz |
Add an additional field to the elf brandinfo structure to support
quicker exec-time replacement of the elf interpreter on an emulation
environment where an entire /compat/* tree isn't really warranted.
Diffstat (limited to 'sys/kern/imgact_elf.c')
-rw-r--r-- | sys/kern/imgact_elf.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index 330437a..ff11078 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -708,6 +708,8 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp) goto fail; } sv = brand_info->sysvec; + if (interp != NULL && brand_info->interp_newpath != NULL) + interp = brand_info->interp_newpath; if ((error = exec_extract_strings(imgp)) != 0) goto fail; @@ -818,21 +820,24 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp) imgp->entry_addr = entry; imgp->proc->p_sysent = sv; - if (interp != NULL) { + if (interp != NULL && brand_info->emul_path != NULL && + brand_info->emul_path[0] != '\0') { path = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); snprintf(path, MAXPATHLEN, "%s%s", brand_info->emul_path, interp); - if ((error = __elfN(load_file)(imgp->proc, path, &addr, - &imgp->entry_addr, sv->sv_pagesize)) != 0) { - if ((error = __elfN(load_file)(imgp->proc, interp, - &addr, &imgp->entry_addr, sv->sv_pagesize)) != 0) { - uprintf("ELF interpreter %s not found\n", - path); - free(path, M_TEMP); - goto fail; - } - } + error = __elfN(load_file)(imgp->proc, path, &addr, + &imgp->entry_addr, sv->sv_pagesize); free(path, M_TEMP); + if (error == 0) + interp = NULL; + } + if (interp != NULL) { + error = __elfN(load_file)(imgp->proc, interp, &addr, + &imgp->entry_addr, sv->sv_pagesize); + if (error != 0) { + uprintf("ELF interpreter %s not found\n", interp); + goto fail; + } } /* |