Date: Fri, 04 Jan 2008 16:05:15 +0000 From: "Poul-Henning Kamp" <phk@phk.freebsd.dk> To: Julian Elischer <julian@elischer.org> Cc: arch@freebsd.org Subject: Re: RFC: sysctl additional functions/macros Message-ID: <6532.1199462715@critter.freebsd.dk> In-Reply-To: Your message of "Fri, 04 Jan 2008 08:00:42 PST." <477E582A.2060106@elischer.org>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <477E582A.2060106@elischer.org>, Julian Elischer writes:
>Poul-Henning Kamp wrote:
>> In message <477D931D.4000303@elischer.org>, Julian Elischer writes:
>>> I would like to extend the current SYSCTL_INT() with
>>> SYSCTL_INT_CLAMPED() or similar, where you also supply a
>>> maximum acceptable value. (and maybe a clue as to what to say if it is
>>> a bad value).
>>
>> I'm not sure I think it is a good idea.
>>
>> Next you'll want SYSCTL_INT_BITMAP(), SYSCTL_INT_POWERS_OF_PI() and
>> so on.
>>
>> A much better idea would be to add a code argument to a version of
>> SYSCTL_INT(), so that people could write something like:
>>
>> SYSCTL_INT(_debug, OID_AUTO, foobar, ORD_WR, &foobar, 0,
>> "mumble desc mumble",
>> {
>> if (newval < 3 || newval > 70 || newval == 59)
>> return (EINVAL);
>> }
>> )
>>
>
>
>I actually considered that already.. It has the advantage of being
>flexible.. but is more intrusive to implement. I think you'd have to
>extend the sysctl_oid structure.
No, you'd just expand the macro to a sysctl-function and declare the
oid as such.
--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6532.1199462715>
