diff options
author | alex <alex@FreeBSD.org> | 1998-10-11 21:08:02 +0000 |
---|---|---|
committer | alex <alex@FreeBSD.org> | 1998-10-11 21:08:02 +0000 |
commit | 772482444a64ad99994f0be272a835430a555237 (patch) | |
tree | a52003872eefb70f586ec367bb1902854e138b4c /sys/alpha | |
parent | 329eb7ae8e5c06bbefd21bcded42eff3cdb63769 (diff) | |
download | FreeBSD-src-772482444a64ad99994f0be272a835430a555237.zip FreeBSD-src-772482444a64ad99994f0be272a835430a555237.tar.gz |
Unregister the glibc2 brand at module unload time.
Change the ELF registration/unregistration scheme to be less error prone.
Adding a new brand requires a single addition to linux_brandlist instead of
modifying linux_load(), linux_unload(), and linux_elf_init().
Approved by: jkh
Reviewed by: msmith
Diffstat (limited to 'sys/alpha')
-rw-r--r-- | sys/alpha/linux/linux_sysvec.c | 24 |
1 files changed, 19 insertions, 5 deletions
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"); |