Date: Mon, 15 Nov 2010 09:53:57 -0800 From: Garrett Cooper <yanegomi@gmail.com> To: freebsd-hackers@freebsd.org Subject: Phantom sysctl Message-ID: <AANLkTik0CgFYKfaGKGktKtUjotfRFjKPOPPbecMRpWDS@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
According to SYSCTL_INT(9): The SYSCTL kernel interfaces allow code to statically declare sysctl(8) MIB entries, which will be initialized when the kernel module containing the declaration is initialized. When the module is unloaded, the sysctl will be automatically destroyed. The sysctl should be reaped when the module is unloaded. My dumb test kernel module [1] doesn't seem to do that though (please note that the OID test_int_sysctl is created, and not reaped... FWIW it's kind of bizarre that test_int_sysctl is created in the first place, given what I've seen when SYSCTL_* gets executed): toaster# kldload ./test_int_sysctl.ko toaster# sysctl -a | grep test test_int_sysctl: 0 vfs.nfs_common.realign_test: 0 debug.test_int_sysctl: 0 toaster# sysctl test_int_sysctl sysctl: unknown oid 'test_int_sysctl' toaster# kldunload ./test_int_sysctl.ko toaster# sysctl -a | grep test test_int_sysctl: 0 vfs.nfs_common.realign_test: 0 toaster# sysctl test_int_sysctl sysctl: unknown oid 'test_int_sysctl' I've seen this behavior on 8.1-RELEASE (custom kernel, vanilla sources), and CURRENT r215254. I'm compiling the kernel with SYSCTL_DEBUG (and added some missing error checking in the kern_sysctl.c code) to see if I can track down the resource issue, but in the meantime if someone more knowledgeable has some suggestions for what to do / where I should look, I'm all ears. Thanks! -Garrett 1. http://pastebin.com/n7d9bH8U
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTik0CgFYKfaGKGktKtUjotfRFjKPOPPbecMRpWDS>