kernel module event handler question

YONETANI Tomokazu qhwt+dfly at
Fri Jun 16 21:37:59 PDT 2006

If the event handler in a kernel module returns an error upon registration,
isn't the module supposed to be removed from the kldstat's list?

I wrote a simple kernel module(attached) which always returns EOPNOTSUPP
for MOD_LOAD event.  It adds two sysctl nodes debug.test and debug.test_int.
Reading from or writing to debug.test calls test_sysctl_proc() function.
When loaded, although module_register_init prints an error message, the
modules sits there, and I can even set different values to debug.test.

Is this an expected behavior?  Do I need to do something special to
unregister my kernel module when something went wrong?

Thanks in advance.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bin00000.bin
Type: application/octet-stream
Size: 874 bytes
Desc: "Description: application/tar-gz"
URL: <>

More information about the Kernel mailing list