Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Mar 2001 14:41:50 +0100
From:      Anton Berezin <tobez@tobez.org>
To:        Adrian Chadd <adrian@FreeBSD.ORG>
Cc:        Robert Watson <rwatson@FreeBSD.ORG>, "Alexey V. Neyman" <avn@any.ru>, "Michael C . Wu" <keichii@peorth.iteration.net>, fs@FreeBSD.ORG, hackers@FreeBSD.ORG
Subject:   Re: tuning a VERY heavily (30.0) loaded s cerver
Message-ID:  <20010324144150.A59930@heechee.tobez.org>
In-Reply-To: <20010323201103.A5828@roaming.cacheboy.net>; from adrian@FreeBSD.ORG on Fri, Mar 23, 2001 at 08:11:03PM %2B0100
References:  <Pine.BSF.4.33.0103230044500.11016-100000@srv2.any> <Pine.NEB.3.96L.1010323083844.26010C-100000@fledge.watson.org> <20010323201103.A5828@roaming.cacheboy.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--k+w/mQv8wyuph6w0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Fri, Mar 23, 2001 at 08:11:03PM +0100, Adrian Chadd wrote:

> A while back I started running through the undocumented sysctls and
> documenting them. I didn't get through all of them, and the main reason
> I stopped was because there wasn't a nifty way to extract the sysctls
> short of writing a script to extract them from /usr/src.
> 
> Someone did point out that you could stuff the sysctl's into an elf
> segment and only load it when needed, but I don't know much about elf.
> If someone would like to do this, I'm sure a small group of us
> (Asmodai? :-P) could walk the sysctl tree again and figure out what
> the undocumented sysctls are. :-)

Some time ago I wrote such a script and even sent it to someone;  never
got any response, though.

It is pretty minimal but does the job.  I believe that the only sysctls
it misses are those which use auxilliary defines to minimize the number
of parameters (like #define P1B_SYSCTL in posix4/posix4_mib.c).

FWIW, the script is attached.

Cheers,
&Anton.
-- 
May the tuna salad be with you.

--k+w/mQv8wyuph6w0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=sysctl_find

#! /usr/bin/perl -w

use File::Find;
use Text::ParseWords;

sub check_file
{
   return unless /\.c$/ && -r;
   local $/;
   open SRC, "< $_"
      or print( "can't open $File::Find::dir: $!"), return;
   my $src = <SRC>; # memory hog
   close SRC;
   my @found = ($src =~ /\nSYSCTL_(\w+\([^()]+\))/sg);
   return unless @found;
   print "$File::Find::dir/$_:\n";
   for (@found) {
      tr/\n\t /   /s;
      my ($type) = /^(\w+)\(/;
      next if $type eq "DECL";
      s/^.*\(//; s/\)//; 
      my @args = quotewords ',', 1, $_;
      #print "|@args|\n";
      $args[0] =~ s/^\s*_//;
      $args[0] =~ s/\s+$//;
      $args[0] =~ tr/_/./;
      $args[2] =~ s/^\s+//;
      $args[2] =~ s/\s+$//;
      print "$type\t$args[0].$args[2]\t$args[-1]\n"; 
   }
}

find( \&check_file, '/usr/src/sys');

--k+w/mQv8wyuph6w0--

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010324144150.A59930>