summaryrefslogtreecommitdiffstats
path: root/sys/svr4
diff options
context:
space:
mode:
authornewton <newton@FreeBSD.org>1999-02-04 12:43:17 +0000
committernewton <newton@FreeBSD.org>1999-02-04 12:43:17 +0000
commit69d836b175c2592919e2b018065242f135bd266f (patch)
tree0a605e8f2fd00fc5479a52d711620e7faddd894c /sys/svr4
parent6266a87e013823a79533aeaa77655454999cfed8 (diff)
downloadFreeBSD-src-69d836b175c2592919e2b018065242f135bd266f.zip
FreeBSD-src-69d836b175c2592919e2b018065242f135bd266f.tar.gz
svr4 emulator will refuse to unload itself if it is currently in use.
Diffstat (limited to 'sys/svr4')
-rw-r--r--sys/svr4/svr4_sysvec.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/svr4/svr4_sysvec.c b/sys/svr4/svr4_sysvec.c
index 8b0997d..7823ef0 100644
--- a/sys/svr4/svr4_sysvec.c
+++ b/sys/svr4/svr4_sysvec.c
@@ -356,16 +356,16 @@ svr4_elf_modevent(module_t mod, int type, void *data)
printf("svr4 ELF exec handler installed\n");
break;
case MOD_UNLOAD:
- /* XXX There needs to be a generic function that any
- * emulator can call to say, "Are any currently-running
- * executables using me?" so we can fail to unload the
- * module if it's in use. Locking up because you forgot
- * to shut down a program prior to a kldunload isn't fun.
- */
- if (elf_remove_brand_entry(&svr4_brand) < 0)
+ /* Only allow the emulator to be removed if it isn't in use. */
+ if (elf_brand_inuse(&svr4_brand) != 0) {
+ error = EBUSY;
+ } else if (elf_remove_brand_entry(&svr4_brand) < 0) {
error = EINVAL;
+ }
+
if (error)
- printf("Could not deinstall ELF interpreter entry\n");
+ printf("Could not deinstall ELF interpreter entry (error %d)\n",
+ error);
else if (bootverbose)
printf("svr4 ELF exec handler removed\n");
break;
OpenPOWER on IntegriCloud