tweaks to sysctl integer value parsing (report any problems)

Robert Watson rwatson at FreeBSD.org
Sun Jun 15 09:48:53 PDT 2003


Last night, I committed some tweaks to how sysctl integer value parsing
occurs.  The motivation for these changes was the outcome of finding the
following in my sysctl.conf:

   kern.maxfiles="4000"

Which, to my great sadness, occurred on a box without DDB or remote power. 
For the uninitiated, until my recent commit, the "4000" would converted to
0, resulting in severely degraded operation (your kernel now exists solely
to report that it is out of files after a reboot).  Now, sysctl will
reject poorly formatted values that will be converted to integers, as well
as empty strings in the integer conversion.  This means that the following
will now generate an error: 

   kern.maxfiles=		# previously: 0
   kern.maxfiles=5"		# previously: 5

I'm not convinced my changes are 100% ideal, so I'm going to be on the
lookout for posts saying "my sysctl.conf no longer works!", and perhaps we
can refine the approach a bit.  On the other hand, I now have only one
working foot after my recent foot-shooting exercise, so I'm fairly
convinced that some change, even if not this precise change, is necessary
:-).

Robert N M Watson             FreeBSD Core Team, TrustedBSD Projects
robert at fledge.watson.org      Network Associates Laboratories



More information about the freebsd-current mailing list