diff options
author | phk <phk@FreeBSD.org> | 2004-07-13 19:36:59 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-07-13 19:36:59 +0000 |
commit | b0e68741889ab66096103a2dec2219bbde3c21c6 (patch) | |
tree | d2eb15e6477b3d5e7e1f7c49c1e2eed3b85ec318 /sys/kern/kern_module.c | |
parent | 7b891087ed78b2c7943c2503f0bfdd7678a6d65c (diff) | |
download | FreeBSD-src-b0e68741889ab66096103a2dec2219bbde3c21c6.zip FreeBSD-src-b0e68741889ab66096103a2dec2219bbde3c21c6.tar.gz |
Give kldunload a -f(orce) argument.
Add a MOD_QUIESCE event for modules. This should return error (EBUSY)
of the module is in use.
MOD_UNLOAD should now only fail if it is impossible (as opposed to
inconvenient) to unload the module. Valid reasons are memory references
into the module which cannot be tracked down and eliminated.
When kldunloading, we abandon if MOD_UNLOAD fails, and if -force is
not given, MOD_QUIESCE failing will also prevent the unload.
For backwards compatibility, we treat EOPNOTSUPP from MOD_QUIESCE as
success.
Document that modules should return EOPNOTSUPP for unknown events.
Diffstat (limited to 'sys/kern/kern_module.c')
-rw-r--r-- | sys/kern/kern_module.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/kern/kern_module.c b/sys/kern/kern_module.c index 3832922..158612e 100644 --- a/sys/kern/kern_module.c +++ b/sys/kern/kern_module.c @@ -215,9 +215,15 @@ module_lookupbyid(int modid) } int -module_unload(module_t mod) +module_unload(module_t mod, int flags) { + int error; + error = MOD_EVENT(mod, MOD_QUIESCE); + if (error == EOPNOTSUPP) + error = 0; + if (flags == LINKER_UNLOAD_NORMAL && error != 0) + return (error); return (MOD_EVENT(mod, MOD_UNLOAD)); } |