Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Jan 2011 17:10:31 -0800
From:      Garrett Cooper <gcooper@FreeBSD.org>
To:        mdf@freebsd.org
Cc:        FreeBSD Arch <freebsd-arch@freebsd.org>
Subject:   Re: Automagic SYSCTLs
Message-ID:  <AANLkTi=EBBM-fhjcGAGDPYwZQGy_MfWyu%2B-ypd2xX%2BDV@mail.gmail.com>
In-Reply-To: <AANLkTi=cbdS0g370r=X%2B=uSd0vsRdC0oRkugq-nsBpgy@mail.gmail.com>
References:  <AANLkTi=cbdS0g370r=X%2B=uSd0vsRdC0oRkugq-nsBpgy@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Jan 15, 2011 at 4:12 PM,  <mdf@freebsd.org> wrote:
> I started out with a plan to import a patch from Isilon that adds
> type-safety to the existing SYSCTLs for scalar variables in the
> kernel. =A0After the discussion on the svn mailing list here
> (http://lists.freebsd.org/pipermail/svn-src-head/2011-January/024097.html=
)
> I now have a prototype patch for SYSCTL_ADD_SCALAR that could replace
> most uses of SYSCTL_ADD_{INT, UINT, LONG, ULONG, QUAD} and is suitable
> for the SYSCTL_ADD_FOO that are used on 16 and 8 bit members (without
> type checking) today.
>
> The gist is that the handler knows the sizeof the variable in the
> kernel and uses this to copy out. =A0For the case of a long, there's
> some goop for SCTL_MASK32. =A0For the case of 8 and 16 bit variables,
> they are still copied in and out as 32-bit quantities.
>
> Let me know if this seems like the right or wrong direction in which
> to move. =A0I haven't tackled the static sysctls as the code I have does
> some run-time evaluation because the code is easier to write that way.
> =A0One possibility is to change the sysctl_oid struct or at least add a
> SIGNED flag; this would also have the advantage of making it possible
> to clean up the CTLTYPE_[U]INT issue where there is no real difference
> between the two CTLTYPEs.
>
> http://people.freebsd.org/~mdf/bsd-sysctl-scalar.diff

Looks interesting, but what are the performance implications of the new log=
ic?
Thanks,
-Garrett



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTi=EBBM-fhjcGAGDPYwZQGy_MfWyu%2B-ypd2xX%2BDV>