summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_module.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-07-14 22:37:36 +0000
committerphk <phk@FreeBSD.org>2004-07-14 22:37:36 +0000
commit6aa084aa4f75fbb50275be0140662f913a9e3669 (patch)
treeaefad5d25942a6ceea7f6f30c5d6c98d489cc2ee /sys/kern/kern_module.c
parentea079c2c7baf7ba642bee3608bbcaba4a6abc22d (diff)
downloadFreeBSD-src-6aa084aa4f75fbb50275be0140662f913a9e3669.zip
FreeBSD-src-6aa084aa4f75fbb50275be0140662f913a9e3669.tar.gz
A module with no modevent function gets modevent_nop() as default.
Until now the function has just returned zero for any event, but that is downright wrong for MOD_UNLOAD and not very useful for any future events we add where it may be crucial to be able to tell if the event was unhandled or successful. Change the function to return as follows: MOD_LOAD -> 0 MOD_UNLOAD -> EBUSY anything else -> EOPNOTSUPP
Diffstat (limited to 'sys/kern/kern_module.c')
-rw-r--r--sys/kern/kern_module.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/kern/kern_module.c b/sys/kern/kern_module.c
index 158612e..a8c704e 100644
--- a/sys/kern/kern_module.c
+++ b/sys/kern/kern_module.c
@@ -66,7 +66,15 @@ static void module_shutdown(void *, int);
static int
modevent_nop(module_t mod, int what, void *arg)
{
- return (0);
+
+ switch(what) {
+ case MOD_LOAD:
+ return (0);
+ case MOD_UNLOAD:
+ return (EBUSY);
+ default:
+ return (EOPNOTSUPP);
+ }
}
static void
OpenPOWER on IntegriCloud