summaryrefslogtreecommitdiffstats
path: root/sys/modules/linux
diff options
context:
space:
mode:
authoralex <alex@FreeBSD.org>1998-10-11 21:08:02 +0000
committeralex <alex@FreeBSD.org>1998-10-11 21:08:02 +0000
commit772482444a64ad99994f0be272a835430a555237 (patch)
treea52003872eefb70f586ec367bb1902854e138b4c /sys/modules/linux
parent329eb7ae8e5c06bbefd21bcded42eff3cdb63769 (diff)
downloadFreeBSD-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/modules/linux')
-rw-r--r--sys/modules/linux/linux.c29
1 files changed, 23 insertions, 6 deletions
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;
OpenPOWER on IntegriCloud