Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Aug 1999 16:20:39 +1000
From:      Peter Jeremy <jeremyp@gsmx07.alcatel.com.au>
To:        geoffr@is.co.za
Cc:        current@FreeBSD.ORG
Subject:   RE: Dropping connections without RST
Message-ID:  <99Aug18.160050est.40350@border.alcanet.com.au>
In-Reply-To: <E3453EC6C52ED3118E7E0090275CD47CFFAFCF@ISJHBEX>

next in thread | previous in thread | raw e-mail | index | archive | help
Geoff Rehmet <geoffr@is.co.za> wrote:
>sysctl -d needs fixing. :-)

No, sysctl -d needs _implementing_.  I've looked into this myself.
I brought it up on -hackers in mid-February, and here in early June.

"sysctl -d" invokes sysctl({0,5,...},...) (sysctl.c:show_var()).

kern_sysctl.c documents (and implements) the following:
/*
 * "Staff-functions"
 *
 * These functions implement a presently undocumented interface 
 * used by the sysctl program to walk the tree, and get the type
 * so it can print the value.
 * This interface is under work and consideration, and should probably
 * be killed with a big axe by the first person who can find the time.
 * (be aware though, that the proper interface isn't as obvious as it
 * may seem, there are various conflicting requirements.
 *
 * {0,0}        printf the entire MIB-tree.
 * {0,1,...}    return the name of the "..." OID.
 * {0,2,...}    return the next OID.
 * {0,3}        return the OID of the name in "new"
 * {0,4,...}    return the kind & format info for the "..." OID.
 */

It would be a fairly trivial exercise (a couple of hours, if that)
to implement sysctl({0,5,...},...).  The downside is the the loaded
kernel would bloat by the size of the sysctl descriptions.  I don't
feel that this is acceptable (and it's definitely unnecessary).

My feeling is that each sysctl should include a 1-line brief
description (which includes any relevant units[0]), followed by a much
longer description of what the sysctl does and when it should (or
shouldn't) be tweaked.  A new option (-D maybe) to sysctl would
display the long description.  An example of what I mean by the latter
is the following (from one of Matt's commits on 1999/02/18 11:57:33
PST):

>       vm.swap_async_max: 4
>       vm.swap_cluster_max: 16
>  
>  Recommended values are a cluster size of 8 or 16 pages.  async_max is
>  about right for 1-4 swap devices.  Reduce to 2 if swap is eating too much
>  bandwidth, or even 1 if swap is both eating too much bandwidth and sitting
>  on a slow network (10BaseT).
>  
>  The defaults work well across a broad range of configurations and should
>  normally be left alone.

I currently have a partially implemented solution which puts the
documentation strings into a separate ELF section, which isn't loaded.
struct sysctl_oid is extended to include a `pointer' to this string
(and will probably need a pointer to the loaded filename[1]).  A new
`staff function' [2] will return the string offset and filename.

There are ~600 sysctl's, so this approach would add ~4.8K to the
loaded i386 kernel image size (and about twice that on an alpha[2]).
(Whereas the actual description strings should be at least an order of
magnitude more).

sysctl(8) will then need to open the specified file and extract the
string at the specified offset.  I'd like to arrange for the offset to
actually be the physical offset within the file - which should be
possible, but I'm having trouble convincing the linker to do this.
Otherwise the sysctl will need to actually decode the ELF structure.

If necessary, the relevant kernel section could be stripped off to
reduce the size of the kernel image on disk.

An alternative approach would be to suitably mark the documentation
strings and extract them into man pages (using a perl tool or
similar).  This would remove `sysctl -d'.

[0] Eg most of the IP timers are in units of 500msec.  This is not
    obvious and has caught out a couple of people here recently.

[1] This is needed to support description strings in KLDs.  The
    pathnames are currently available in KVM.

[2] Probably {0,6,...} to prevent compatibility problems with old
    sysctl(8) programs (since the return information will be
    different).

[3] Depending on the implementation, and the layout of struct
    sysctl_oid, this could either be ~9.6K (appending both fields)
    or ~4.8K (append the pathname pointer, put the 32-bit offset
    field into some existing padding).

Peter


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?99Aug18.160050est.40350>