Date: Mon, 15 Nov 2010 11:40:16 -0800 From: mdf@FreeBSD.org To: Garrett Cooper <yanegomi@gmail.com> Cc: freebsd-hackers@freebsd.org Subject: Re: Phantom sysctl Message-ID: <AANLkTikft0yuWfnmC02AUkKcQtreKzGVNmhvU%2BgZFiYZ@mail.gmail.com> In-Reply-To: <AANLkTik0CgFYKfaGKGktKtUjotfRFjKPOPPbecMRpWDS@mail.gmail.com> References: <AANLkTik0CgFYKfaGKGktKtUjotfRFjKPOPPbecMRpWDS@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Nov 15, 2010 at 9:53 AM, Garrett Cooper <yanegomi@gmail.com> wrote: > =A0 =A0According to SYSCTL_INT(9): > > =A0 =A0 The SYSCTL kernel interfaces allow code to statically declare sys= ctl(8) > =A0 =A0 MIB entries, which will be initialized when the kernel module con= taining > =A0 =A0 the declaration is initialized. =A0When the module is unloaded, t= he sysctl > =A0 =A0 will be automatically destroyed. > > =A0 =A0The 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 debug.test_int_sysctl did disappear, and that was the sysctl in the module: SYSCTL_INT(_debug, OID_AUTO, test_int_sysctl, CTLFLAG_RW, &_sysctl, 0, "Test sysctl OID"); I am not sure where the other test_int_sysctl appeared from, but the results of "sysctl test_int_sysctl" didn't change from before kldunload to after. Thanks, matthew > toaster# sysctl test_int_sysctl > sysctl: unknown oid 'test_int_sysctl' > > =A0 =A0I've seen this behavior on 8.1-RELEASE (custom kernel, vanilla > sources), and CURRENT r215254. > =A0 =A0I'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 > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org= " >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTikft0yuWfnmC02AUkKcQtreKzGVNmhvU%2BgZFiYZ>