From 35eb8c5aa20878f727b0143405166e9b463ee24a Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Wed, 26 Mar 2003 18:29:44 +0000 Subject: [PATCH] Add a cleanup function to destroy the osname_lock and call it on module unload. Submitted by: gallatin Reported by: Martin Karlsson --- sys/alpha/linux/linux_sysvec.c | 1 + sys/compat/linux/linux_mib.c | 7 +++++++ sys/compat/linux/linux_mib.h | 2 ++ sys/i386/linux/linux_sysvec.c | 1 + 4 files changed, 11 insertions(+) diff --git a/sys/alpha/linux/linux_sysvec.c b/sys/alpha/linux/linux_sysvec.c index 40deced2cf0..42424d16b5f 100644 --- a/sys/alpha/linux/linux_sysvec.c +++ b/sys/alpha/linux/linux_sysvec.c @@ -264,6 +264,7 @@ linux_elf_modevent(module_t mod, int type, void *data) linux_ioctl_unregister_handler(*lihp); if (bootverbose) printf("Linux ELF exec handler removed\n"); + linux_mib_destroy(); } else printf("Could not deinstall ELF interpreter entry\n"); break; diff --git a/sys/compat/linux/linux_mib.c b/sys/compat/linux/linux_mib.c index 53fee72d54f..9d908745888 100644 --- a/sys/compat/linux/linux_mib.c +++ b/sys/compat/linux/linux_mib.c @@ -148,6 +148,13 @@ linux_get_prison(struct thread *td) return (pr); } +void +linux_mib_destroy(void) +{ + + mtx_destroy(&osname_lock); +} + void linux_get_osname(struct thread *td, char *dst) { diff --git a/sys/compat/linux/linux_mib.h b/sys/compat/linux/linux_mib.h index 42d9d899266..b68e57fd323 100644 --- a/sys/compat/linux/linux_mib.h +++ b/sys/compat/linux/linux_mib.h @@ -31,6 +31,8 @@ #ifndef _LINUX_MIB_H_ #define _LINUX_MIB_H_ +void linux_mib_destroy(void); + void linux_get_osname(struct thread *td, char *dst); int linux_set_osname(struct thread *td, char *osname); diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index c324f82837a..f8cc1088845 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -925,6 +925,7 @@ linux_elf_modevent(module_t mod, int type, void *data) linux_ioctl_unregister_handler(*lihp); if (bootverbose) printf("Linux ELF exec handler removed\n"); + linux_mib_destroy(); } else printf("Could not deinstall ELF interpreter entry\n"); break;