diff options
-rw-r--r-- | lkm/linux/linux.c | 29 | ||||
-rw-r--r-- | sys/alpha/linux/linux_sysvec.c | 24 | ||||
-rw-r--r-- | sys/i386/linux/linux_sysvec.c | 24 | ||||
-rw-r--r-- | sys/modules/linux/linux.c | 29 |
4 files changed, 84 insertions, 22 deletions
diff --git a/lkm/linux/linux.c b/lkm/linux/linux.c index 11898c3..b3da352 100644 --- a/lkm/linux/linux.c +++ b/lkm/linux/linux.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux.c,v 1.12 1997/05/01 06:08:14 jkh Exp $ + * $Id: linux.c,v 1.13 1998/09/17 22:08:34 msmith Exp $ */ #include <sys/param.h> @@ -41,14 +41,22 @@ extern const struct execsw linux_execsw; MOD_EXEC(linux, -1, &linux_execsw); -extern Elf32_Brandinfo linux_brand, linux_glibc2brand; +extern Elf32_Brandinfo *linux_brandlist[]; static int linux_load(struct lkm_table *lkmtp, int cmd) { - if ((elf_insert_brand_entry(&linux_brand)) || - (elf_insert_brand_entry(&linux_glibc2brand))) - uprintf("Could not install ELF interpreter entry\n"); + Elf32_Brandinfo **brandinfo; + int error; + + error = 0; + + for (brandinfo = &linux_brandlist[0]; *brandinfo != NULL; ++brandinfo) + if (elf_insert_brand_entry(*brandinfo) < 0) + error = 1; + + if (error) + printf("Could not install ELF interpreter entry\n"); /* uprintf("Linux emulator installed\n"); XXX - shut up, you! */ return 0; } @@ -56,7 +64,16 @@ linux_load(struct lkm_table *lkmtp, int cmd) static int linux_unload(struct lkm_table *lkmtp, int cmd) { - if (elf_remove_brand_entry(&linux_brand)) + Elf32_Brandinfo **brandinfo; + int error; + + error = 0; + + for (brandinfo = &linux_brandlist[0]; *brandinfo != NULL; ++brandinfo) + if (elf_remove_brand_entry(*brandinfo) < 0) + error = 1; + + if (error) uprintf("Could not deinstall ELF interpreter entry\n"); uprintf("Linux emulator removed\n"); return 0; diff --git a/sys/alpha/linux/linux_sysvec.c b/sys/alpha/linux/linux_sysvec.c index b2ba2da..5600111 100644 --- a/sys/alpha/linux/linux_sysvec.c +++ b/sys/alpha/linux/linux_sysvec.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_sysvec.c,v 1.34 1998/09/17 22:08:29 msmith Exp $ + * $Id: linux_sysvec.c,v 1.35 1998/10/05 16:37:36 jfieber Exp $ */ /* XXX we use functions that might not exist. */ @@ -427,20 +427,26 @@ struct sysentvec elf_linux_sysvec = { /* * Installed either via SYSINIT() or via LKM stubs. */ -Elf32_Brandinfo linux_brand = { +static Elf32_Brandinfo linux_brand = { "Linux", "/compat/linux", "/lib/ld-linux.so.1", &elf_linux_sysvec }; -Elf32_Brandinfo linux_glibc2brand = { +static Elf32_Brandinfo linux_glibc2brand = { "Linux", "/compat/linux", "/lib/ld-linux.so.2", &elf_linux_sysvec }; +Elf32_Brandinfo *linux_brandlist[] = { + &linux_brand, + &linux_glibc2brand, + NULL + }; + #ifndef LKM /* * XXX: this is WRONG, it needs to be SI_SUB_EXEC, but this is just at the @@ -452,8 +458,16 @@ static void linux_elf_init(dummy) void *dummy; { - if ((elf_insert_brand_entry(&linux_brand) < 0) || - (elf_insert_brand_entry(&linux_glibc2brand) < 0)) + Elf32_Brandinfo **brandinfo; + int error; + + error = 0; + + for (brandinfo = &linux_brandlist[0]; *brandinfo != NULL; ++brandinfo) + if (elf_insert_brand_entry(*brandinfo) < 0) + error = 1; + + if (error) printf("cannot insert Linux elf brand handler\n"); else if (bootverbose) printf("Linux-ELF exec handler installed\n"); diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index b2ba2da..5600111 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_sysvec.c,v 1.34 1998/09/17 22:08:29 msmith Exp $ + * $Id: linux_sysvec.c,v 1.35 1998/10/05 16:37:36 jfieber Exp $ */ /* XXX we use functions that might not exist. */ @@ -427,20 +427,26 @@ struct sysentvec elf_linux_sysvec = { /* * Installed either via SYSINIT() or via LKM stubs. */ -Elf32_Brandinfo linux_brand = { +static Elf32_Brandinfo linux_brand = { "Linux", "/compat/linux", "/lib/ld-linux.so.1", &elf_linux_sysvec }; -Elf32_Brandinfo linux_glibc2brand = { +static Elf32_Brandinfo linux_glibc2brand = { "Linux", "/compat/linux", "/lib/ld-linux.so.2", &elf_linux_sysvec }; +Elf32_Brandinfo *linux_brandlist[] = { + &linux_brand, + &linux_glibc2brand, + NULL + }; + #ifndef LKM /* * XXX: this is WRONG, it needs to be SI_SUB_EXEC, but this is just at the @@ -452,8 +458,16 @@ static void linux_elf_init(dummy) void *dummy; { - if ((elf_insert_brand_entry(&linux_brand) < 0) || - (elf_insert_brand_entry(&linux_glibc2brand) < 0)) + Elf32_Brandinfo **brandinfo; + int error; + + error = 0; + + for (brandinfo = &linux_brandlist[0]; *brandinfo != NULL; ++brandinfo) + if (elf_insert_brand_entry(*brandinfo) < 0) + error = 1; + + if (error) printf("cannot insert Linux elf brand handler\n"); else if (bootverbose) printf("Linux-ELF exec handler installed\n"); diff --git a/sys/modules/linux/linux.c b/sys/modules/linux/linux.c index 11898c3..b3da352 100644 --- a/sys/modules/linux/linux.c +++ b/sys/modules/linux/linux.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux.c,v 1.12 1997/05/01 06:08:14 jkh Exp $ + * $Id: linux.c,v 1.13 1998/09/17 22:08:34 msmith Exp $ */ #include <sys/param.h> @@ -41,14 +41,22 @@ extern const struct execsw linux_execsw; MOD_EXEC(linux, -1, &linux_execsw); -extern Elf32_Brandinfo linux_brand, linux_glibc2brand; +extern Elf32_Brandinfo *linux_brandlist[]; static int linux_load(struct lkm_table *lkmtp, int cmd) { - if ((elf_insert_brand_entry(&linux_brand)) || - (elf_insert_brand_entry(&linux_glibc2brand))) - uprintf("Could not install ELF interpreter entry\n"); + Elf32_Brandinfo **brandinfo; + int error; + + error = 0; + + for (brandinfo = &linux_brandlist[0]; *brandinfo != NULL; ++brandinfo) + if (elf_insert_brand_entry(*brandinfo) < 0) + error = 1; + + if (error) + printf("Could not install ELF interpreter entry\n"); /* uprintf("Linux emulator installed\n"); XXX - shut up, you! */ return 0; } @@ -56,7 +64,16 @@ linux_load(struct lkm_table *lkmtp, int cmd) static int linux_unload(struct lkm_table *lkmtp, int cmd) { - if (elf_remove_brand_entry(&linux_brand)) + Elf32_Brandinfo **brandinfo; + int error; + + error = 0; + + for (brandinfo = &linux_brandlist[0]; *brandinfo != NULL; ++brandinfo) + if (elf_remove_brand_entry(*brandinfo) < 0) + error = 1; + + if (error) uprintf("Could not deinstall ELF interpreter entry\n"); uprintf("Linux emulator removed\n"); return 0; |