1
0
mirror of https://github.com/golang/go synced 2024-11-20 00:04:43 -07:00

syscall: implement nametomib for openbsd.

Move the existing darwin/freebsd specific nametomib implementation
into the respective operating system dependent files.

Provide a nametomib implementation for openbsd, which operates on a
sysctl MIB that has been pre-generated from the various system headers
by mksysctl_openbsd.pl.

R=rsc
CC=golang-dev
https://golang.org/cl/4935044
This commit is contained in:
Joel Sing 2011-11-17 23:13:49 +11:00
parent a1dbfa6f09
commit 773a921ccb
8 changed files with 629 additions and 25 deletions

View File

@ -54,6 +54,7 @@ GOFILES_openbsd=\
sockcmsg_unix.go\ sockcmsg_unix.go\
syscall_bsd.go\ syscall_bsd.go\
syscall_unix.go\ syscall_unix.go\
zsysctl_openbsd.go\
GOFILES_windows=\ GOFILES_windows=\
env_windows.go\ env_windows.go\

View File

@ -79,6 +79,8 @@ GOOSARCH="${GOOS}_${GOARCH}"
mksyscall="./mksyscall.pl" mksyscall="./mksyscall.pl"
mkerrors="./mkerrors.sh" mkerrors="./mkerrors.sh"
zerrors="zerrors_$GOOSARCH.go" zerrors="zerrors_$GOOSARCH.go"
mksysctl=""
zsysctl="zsysctl_$GOOSARCH.go"
run="sh" run="sh"
case "$1" in case "$1" in
@ -169,12 +171,16 @@ plan9_386)
openbsd_386) openbsd_386)
mkerrors="$mkerrors -m32" mkerrors="$mkerrors -m32"
mksyscall="./mksyscall.pl -l32 -openbsd" mksyscall="./mksyscall.pl -l32 -openbsd"
mksysctl="./mksysctl_openbsd.pl"
zsysctl="zsysctl_openbsd.go"
mksysnum="curl -s 'http://www.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl" mksysnum="curl -s 'http://www.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
mktypes="GOARCH=$GOARCH cgo -godefs" mktypes="GOARCH=$GOARCH cgo -godefs"
;; ;;
openbsd_amd64) openbsd_amd64)
mkerrors="$mkerrors -m64" mkerrors="$mkerrors -m64"
mksyscall="./mksyscall.pl -openbsd" mksyscall="./mksyscall.pl -openbsd"
mksysctl="./mksysctl_openbsd.pl"
zsysctl="zsysctl_openbsd.go"
mksysnum="curl -s 'http://www.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl" mksysnum="curl -s 'http://www.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
mktypes="GOARCH=$GOARCH cgo -godefs" mktypes="GOARCH=$GOARCH cgo -godefs"
;; ;;
@ -192,6 +198,7 @@ esac
syscall_goos="syscall_bsd.go $syscall_goos" syscall_goos="syscall_bsd.go $syscall_goos"
;; ;;
esac esac
if [ -n "$mksysctl" ]; then echo "$mksysctl |gofmt >$zsysctl"; fi
if [ -n "$mksyscall" ]; then echo "$mksyscall $syscall_goos syscall_$GOOSARCH.go |gofmt >zsyscall_$GOOSARCH.go"; fi if [ -n "$mksyscall" ]; then echo "$mksyscall $syscall_goos syscall_$GOOSARCH.go |gofmt >zsyscall_$GOOSARCH.go"; fi
if [ -n "$mksysnum" ]; then echo "$mksysnum |gofmt >zsysnum_$GOOSARCH.go"; fi if [ -n "$mksysnum" ]; then echo "$mksysnum |gofmt >zsysnum_$GOOSARCH.go"; fi
if [ -n "$mktypes" ]; then echo "$mktypes types_$GOOS.go |gofmt >ztypes_$GOOSARCH.go"; fi if [ -n "$mktypes" ]; then echo "$mktypes types_$GOOS.go |gofmt >ztypes_$GOOSARCH.go"; fi

View File

@ -0,0 +1,257 @@
#!/usr/bin/perl
# Copyright 2011 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
#
# Parse the header files for OpenBSD and generate a Go usable sysctl MIB.
#
# Build a MIB with each entry being an array containing the level, type and
# a hash that will contain additional entries if the current entry is a node.
# We then walk this MIB and create a flattened sysctl name to OID hash.
#
use strict;
my $debug = 0;
my %ctls = ();
my @headers = qw (
sys/sysctl.h
sys/socket.h
sys/tty.h
sys/malloc.h
sys/mount.h
sys/namei.h
sys/sem.h
sys/shm.h
sys/vmmeter.h
uvm/uvm_param.h
uvm/uvm_swap_encrypt.h
ddb/db_var.h
net/if.h
net/if_pfsync.h
net/pipex.h
netinet/in.h
netinet/icmp_var.h
netinet/igmp_var.h
netinet/ip_ah.h
netinet/ip_carp.h
netinet/ip_divert.h
netinet/ip_esp.h
netinet/ip_ether.h
netinet/ip_gre.h
netinet/ip_ipcomp.h
netinet/ip_ipip.h
netinet/pim_var.h
netinet/tcp_var.h
netinet/udp_var.h
netinet6/in6.h
netinet6/ip6_divert.h
netinet6/pim6_var.h
netinet/icmp6.h
netmpls/mpls.h
);
my @ctls = qw (
kern
vm
fs
net
#debug # Special handling required
hw
#machdep # Arch specific
user
ddb
#vfs # Special handling required
fs.posix
kern.forkstat
kern.intrcnt
kern.malloc
kern.nchstats
kern.seminfo
kern.shminfo
kern.timecounter
kern.tty
kern.watchdog
net.bpf
net.ifq
net.inet
net.inet.ah
net.inet.carp
net.inet.divert
net.inet.esp
net.inet.etherip
net.inet.gre
net.inet.icmp
net.inet.igmp
net.inet.ip
net.inet.ip.ifq
net.inet.ipcomp
net.inet.ipip
net.inet.mobileip
net.inet.pfsync
net.inet.pim
net.inet.tcp
net.inet.udp
net.inet6
net.inet6.divert
net.inet6.ip6
net.inet6.icmp6
net.inet6.pim6
net.inet6.tcp6
net.inet6.udp6
net.mpls
net.mpls.ifq
net.key
net.pflow
net.pfsync
net.pipex
net.rt
vm.swapencrypt
#vfsgenctl # Special handling required
);
# Node name "fixups"
my %ctl_map = (
"ipproto" => "net.inet",
"net.inet.ipproto" => "net.inet",
"net.inet6.ipv6proto" => "net.inet6",
"net.inet6.ipv6" => "net.inet6.ip6",
"net.inet.icmpv6" => "net.inet6.icmp6",
"net.inet6.divert6" => "net.inet6.divert",
"net.inet6.tcp6" => "net.inet.tcp",
"net.inet6.udp6" => "net.inet.udp",
"mpls" => "net.mpls",
"swpenc" => "vm.swapencrypt"
);
# Node mappings
my %node_map = (
"net.inet.ip.ifq" => "net.ifq",
"net.inet.pfsync" => "net.pfsync",
"net.mpls.ifq" => "net.ifq"
);
my $ctlname;
my %mib = ();
my %sysctl = ();
my $node;
sub debug() {
print STDERR "$_[0]\n" if $debug;
}
# Walk the MIB and build a sysctl name to OID mapping.
sub build_sysctl() {
my ($node, $name, $oid) = @_;
my %node = %{$node};
my @oid = @{$oid};
foreach my $key (sort keys %node) {
my @node = @{$node{$key}};
my $nodename = $name.($name ne '' ? '.' : '').$key;
my @nodeoid = (@oid, $node[0]);
if ($node[1] eq 'CTLTYPE_NODE') {
if (exists $node_map{$nodename}) {
$node = \%mib;
$ctlname = $node_map{$nodename};
foreach my $part (split /\./, $ctlname) {
$node = \%{@{$$node{$part}}[2]};
}
} else {
$node = $node[2];
}
&build_sysctl($node, $nodename, \@nodeoid);
} elsif ($node[1] ne '') {
$sysctl{$nodename} = \@nodeoid;
}
}
}
foreach my $ctl (@ctls) {
$ctls{$ctl} = $ctl;
}
# Build MIB
foreach my $header (@headers) {
&debug("Processing $header...");
open HEADER, "/usr/include/$header" ||
print STDERR "Failed to open $header\n";
while (<HEADER>) {
if ($_ =~ /^#define\s+(CTL_NAMES)\s+{/ ||
$_ =~ /^#define\s+(CTL_(.*)_NAMES)\s+{/ ||
$_ =~ /^#define\s+((.*)CTL_NAMES)\s+{/) {
if ($1 eq 'CTL_NAMES') {
# Top level.
$node = \%mib;
} else {
# Node.
my $nodename = lc($2);
if ($header =~ /^netinet\//) {
$ctlname = "net.inet.$nodename";
} elsif ($header =~ /^netinet6\//) {
$ctlname = "net.inet6.$nodename";
} elsif ($header =~ /^net\//) {
$ctlname = "net.$nodename";
} else {
$ctlname = "$nodename";
$ctlname =~ s/^(fs|net|kern)_/$1\./;
}
if (exists $ctl_map{$ctlname}) {
$ctlname = $ctl_map{$ctlname};
}
if (not exists $ctls{$ctlname}) {
&debug("Ignoring $ctlname...");
next;
}
# Walk down from the top of the MIB.
$node = \%mib;
foreach my $part (split /\./, $ctlname) {
if (not exists $$node{$part}) {
&debug("Missing node $part");
$$node{$part} = [ 0, '', {} ];
}
$node = \%{@{$$node{$part}}[2]};
}
}
# Populate current node with entries.
my $i = -1;
while (defined($_) && $_ !~ /^}/) {
$_ = <HEADER>;
$i++ if $_ =~ /{.*}/;
next if $_ !~ /{\s+"(\w+)",\s+(CTLTYPE_[A-Z]+)\s+}/;
$$node{$1} = [ $i, $2, {} ];
}
}
}
close HEADER;
}
&build_sysctl(\%mib, "", []);
print <<EOF;
// mksysctl_openbsd.pl
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
package syscall;
type mibentry struct {
ctlname string
ctloid []_C_int
}
var sysctlMib = []mibentry {
EOF
foreach my $name (sort keys %sysctl) {
my @oid = @{$sysctl{$name}};
print "\t{ \"$name\", []_C_int{ ", join(', ', @oid), " } }, \n";
}
print <<EOF;
}
EOF

View File

@ -546,31 +546,6 @@ func Kevent(kq int, changes, events []Kevent_t, timeout *Timespec) (n int, err e
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL //sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
// Translate "kern.hostname" to []_C_int{0,1,2,3}.
func nametomib(name string) (mib []_C_int, err error) {
const siz = unsafe.Sizeof(mib[0])
// NOTE(rsc): It seems strange to set the buffer to have
// size CTL_MAXNAME+2 but use only CTL_MAXNAME
// as the size. I don't know why the +2 is here, but the
// kernel uses +2 for its own implementation of this function.
// I am scared that if we don't include the +2 here, the kernel
// will silently write 2 words farther than we specify
// and we'll get memory corruption.
var buf [CTL_MAXNAME + 2]_C_int
n := uintptr(CTL_MAXNAME) * siz
p := (*byte)(unsafe.Pointer(&buf[0]))
bytes := StringByteSlice(name)
// Magic sysctl: "setting" 0.3 to a string name
// lets you read back the array of integers form.
if err = sysctl([]_C_int{0, 3}, p, &n, &bytes[0], uintptr(len(name))); err != nil {
return nil, err
}
return buf[0 : n/siz], nil
}
func Sysctl(name string) (value string, err error) { func Sysctl(name string) (value string, err error) {
// Translate name to mib number. // Translate name to mib number.
mib, err := nametomib(name) mib, err := nametomib(name)

View File

@ -28,6 +28,31 @@ type SockaddrDatalink struct {
raw RawSockaddrDatalink raw RawSockaddrDatalink
} }
// Translate "kern.hostname" to []_C_int{0,1,2,3}.
func nametomib(name string) (mib []_C_int, err error) {
const siz = unsafe.Sizeof(mib[0])
// NOTE(rsc): It seems strange to set the buffer to have
// size CTL_MAXNAME+2 but use only CTL_MAXNAME
// as the size. I don't know why the +2 is here, but the
// kernel uses +2 for its own implementation of this function.
// I am scared that if we don't include the +2 here, the kernel
// will silently write 2 words farther than we specify
// and we'll get memory corruption.
var buf [CTL_MAXNAME + 2]_C_int
n := uintptr(CTL_MAXNAME) * siz
p := (*byte)(unsafe.Pointer(&buf[0]))
bytes := StringByteSlice(name)
// Magic sysctl: "setting" 0.3 to a string name
// lets you read back the array of integers form.
if err = sysctl([]_C_int{0, 3}, p, &n, &bytes[0], uintptr(len(name))); err != nil {
return nil, err
}
return buf[0 : n/siz], nil
}
// ParseDirent parses up to max directory entries in buf, // ParseDirent parses up to max directory entries in buf,
// appending the names to names. It returns the number // appending the names to names. It returns the number
// bytes consumed from buf, the number of entries added // bytes consumed from buf, the number of entries added

View File

@ -28,6 +28,31 @@ type SockaddrDatalink struct {
raw RawSockaddrDatalink raw RawSockaddrDatalink
} }
// Translate "kern.hostname" to []_C_int{0,1,2,3}.
func nametomib(name string) (mib []_C_int, err error) {
const siz = unsafe.Sizeof(mib[0])
// NOTE(rsc): It seems strange to set the buffer to have
// size CTL_MAXNAME+2 but use only CTL_MAXNAME
// as the size. I don't know why the +2 is here, but the
// kernel uses +2 for its own implementation of this function.
// I am scared that if we don't include the +2 here, the kernel
// will silently write 2 words farther than we specify
// and we'll get memory corruption.
var buf [CTL_MAXNAME + 2]_C_int
n := uintptr(CTL_MAXNAME) * siz
p := (*byte)(unsafe.Pointer(&buf[0]))
bytes := StringByteSlice(name)
// Magic sysctl: "setting" 0.3 to a string name
// lets you read back the array of integers form.
if err = sysctl([]_C_int{0, 3}, p, &n, &bytes[0], uintptr(len(name))); err != nil {
return nil, err
}
return buf[0 : n/siz], nil
}
// ParseDirent parses up to max directory entries in buf, // ParseDirent parses up to max directory entries in buf,
// appending the names to names. It returns the number // appending the names to names. It returns the number
// bytes consumed from buf, the number of entries added // bytes consumed from buf, the number of entries added

View File

@ -30,6 +30,28 @@ type SockaddrDatalink struct {
func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno)
func nametomib(name string) (mib []_C_int, err error) {
// Perform lookup via a binary search
left := 0
right := len(sysctlMib) - 1
for {
idx := left + (right-left)/2
switch {
case name == sysctlMib[idx].ctlname:
return sysctlMib[idx].ctloid, nil
case name > sysctlMib[idx].ctlname:
left = idx + 1
default:
right = idx - 1
}
if left > right {
break
}
}
return nil, EINVAL
}
// ParseDirent parses up to max directory entries in buf, // ParseDirent parses up to max directory entries in buf,
// appending the names to names. It returns the number // appending the names to names. It returns the number
// bytes consumed from buf, the number of entries added // bytes consumed from buf, the number of entries added

View File

@ -0,0 +1,292 @@
// mksysctl_openbsd.pl
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
package syscall
type mibentry struct {
ctlname string
ctloid []_C_int
}
var sysctlMib = []mibentry{
{"ddb.console", []_C_int{9, 6}},
{"ddb.log", []_C_int{9, 7}},
{"ddb.max_line", []_C_int{9, 3}},
{"ddb.max_width", []_C_int{9, 2}},
{"ddb.panic", []_C_int{9, 5}},
{"ddb.radix", []_C_int{9, 1}},
{"ddb.tab_stop_width", []_C_int{9, 4}},
{"ddb.trigger", []_C_int{9, 8}},
{"fs.posix.setuid", []_C_int{3, 1, 1}},
{"hw.allowpowerdown", []_C_int{6, 22}},
{"hw.byteorder", []_C_int{6, 4}},
{"hw.cpuspeed", []_C_int{6, 12}},
{"hw.diskcount", []_C_int{6, 10}},
{"hw.disknames", []_C_int{6, 8}},
{"hw.diskstats", []_C_int{6, 9}},
{"hw.machine", []_C_int{6, 1}},
{"hw.model", []_C_int{6, 2}},
{"hw.ncpu", []_C_int{6, 3}},
{"hw.ncpufound", []_C_int{6, 21}},
{"hw.pagesize", []_C_int{6, 7}},
{"hw.physmem", []_C_int{6, 19}},
{"hw.product", []_C_int{6, 15}},
{"hw.serialno", []_C_int{6, 17}},
{"hw.setperf", []_C_int{6, 13}},
{"hw.usermem", []_C_int{6, 20}},
{"hw.uuid", []_C_int{6, 18}},
{"hw.vendor", []_C_int{6, 14}},
{"hw.version", []_C_int{6, 16}},
{"kern.arandom", []_C_int{1, 37}},
{"kern.argmax", []_C_int{1, 8}},
{"kern.boottime", []_C_int{1, 21}},
{"kern.bufcachepercent", []_C_int{1, 72}},
{"kern.ccpu", []_C_int{1, 45}},
{"kern.clockrate", []_C_int{1, 12}},
{"kern.consdev", []_C_int{1, 75}},
{"kern.cp_time", []_C_int{1, 40}},
{"kern.cp_time2", []_C_int{1, 71}},
{"kern.cryptodevallowsoft", []_C_int{1, 53}},
{"kern.domainname", []_C_int{1, 22}},
{"kern.file", []_C_int{1, 15}},
{"kern.file2", []_C_int{1, 73}},
{"kern.forkstat", []_C_int{1, 42}},
{"kern.fscale", []_C_int{1, 46}},
{"kern.fsync", []_C_int{1, 33}},
{"kern.hostid", []_C_int{1, 11}},
{"kern.hostname", []_C_int{1, 10}},
{"kern.intrcnt.nintrcnt", []_C_int{1, 63, 1}},
{"kern.job_control", []_C_int{1, 19}},
{"kern.malloc.buckets", []_C_int{1, 39, 1}},
{"kern.malloc.kmemnames", []_C_int{1, 39, 3}},
{"kern.maxclusters", []_C_int{1, 67}},
{"kern.maxfiles", []_C_int{1, 7}},
{"kern.maxlocksperuid", []_C_int{1, 70}},
{"kern.maxpartitions", []_C_int{1, 23}},
{"kern.maxproc", []_C_int{1, 6}},
{"kern.maxvnodes", []_C_int{1, 5}},
{"kern.mbstat", []_C_int{1, 59}},
{"kern.msgbuf", []_C_int{1, 48}},
{"kern.msgbufsize", []_C_int{1, 38}},
{"kern.nchstats", []_C_int{1, 41}},
{"kern.netlivelocks", []_C_int{1, 76}},
{"kern.nfiles", []_C_int{1, 56}},
{"kern.ngroups", []_C_int{1, 18}},
{"kern.nosuidcoredump", []_C_int{1, 32}},
{"kern.nprocs", []_C_int{1, 47}},
{"kern.nselcoll", []_C_int{1, 43}},
{"kern.numvnodes", []_C_int{1, 58}},
{"kern.osrelease", []_C_int{1, 2}},
{"kern.osrevision", []_C_int{1, 3}},
{"kern.ostype", []_C_int{1, 1}},
{"kern.osversion", []_C_int{1, 27}},
{"kern.pool_debug", []_C_int{1, 77}},
{"kern.posix1version", []_C_int{1, 17}},
{"kern.proc", []_C_int{1, 66}},
{"kern.random", []_C_int{1, 31}},
{"kern.rawpartition", []_C_int{1, 24}},
{"kern.rthreads", []_C_int{1, 74}},
{"kern.saved_ids", []_C_int{1, 20}},
{"kern.securelevel", []_C_int{1, 9}},
{"kern.seminfo", []_C_int{1, 61}},
{"kern.shminfo", []_C_int{1, 62}},
{"kern.somaxconn", []_C_int{1, 28}},
{"kern.sominconn", []_C_int{1, 29}},
{"kern.splassert", []_C_int{1, 54}},
{"kern.stackgap_random", []_C_int{1, 50}},
{"kern.sysvipc_info", []_C_int{1, 51}},
{"kern.sysvmsg", []_C_int{1, 34}},
{"kern.sysvsem", []_C_int{1, 35}},
{"kern.sysvshm", []_C_int{1, 36}},
{"kern.timecounter.choice", []_C_int{1, 69, 4}},
{"kern.timecounter.hardware", []_C_int{1, 69, 3}},
{"kern.timecounter.tick", []_C_int{1, 69, 1}},
{"kern.timecounter.timestepwarnings", []_C_int{1, 69, 2}},
{"kern.tty.maxptys", []_C_int{1, 44, 6}},
{"kern.tty.nptys", []_C_int{1, 44, 7}},
{"kern.tty.tk_cancc", []_C_int{1, 44, 4}},
{"kern.tty.tk_nin", []_C_int{1, 44, 1}},
{"kern.tty.tk_nout", []_C_int{1, 44, 2}},
{"kern.tty.tk_rawcc", []_C_int{1, 44, 3}},
{"kern.tty.ttyinfo", []_C_int{1, 44, 5}},
{"kern.ttycount", []_C_int{1, 57}},
{"kern.userasymcrypto", []_C_int{1, 60}},
{"kern.usercrypto", []_C_int{1, 52}},
{"kern.usermount", []_C_int{1, 30}},
{"kern.version", []_C_int{1, 4}},
{"kern.vnode", []_C_int{1, 13}},
{"kern.watchdog.auto", []_C_int{1, 64, 2}},
{"kern.watchdog.period", []_C_int{1, 64, 1}},
{"net.bpf.bufsize", []_C_int{4, 31, 1}},
{"net.bpf.maxbufsize", []_C_int{4, 31, 2}},
{"net.inet.ah.enable", []_C_int{4, 2, 51, 1}},
{"net.inet.ah.stats", []_C_int{4, 2, 51, 2}},
{"net.inet.carp.allow", []_C_int{4, 2, 112, 1}},
{"net.inet.carp.log", []_C_int{4, 2, 112, 3}},
{"net.inet.carp.preempt", []_C_int{4, 2, 112, 2}},
{"net.inet.carp.stats", []_C_int{4, 2, 112, 4}},
{"net.inet.divert.recvspace", []_C_int{4, 2, 258, 1}},
{"net.inet.divert.sendspace", []_C_int{4, 2, 258, 2}},
{"net.inet.divert.stats", []_C_int{4, 2, 258, 3}},
{"net.inet.esp.enable", []_C_int{4, 2, 50, 1}},
{"net.inet.esp.stats", []_C_int{4, 2, 50, 4}},
{"net.inet.esp.udpencap", []_C_int{4, 2, 50, 2}},
{"net.inet.esp.udpencap_port", []_C_int{4, 2, 50, 3}},
{"net.inet.etherip.allow", []_C_int{4, 2, 97, 1}},
{"net.inet.etherip.stats", []_C_int{4, 2, 97, 2}},
{"net.inet.gre.allow", []_C_int{4, 2, 47, 1}},
{"net.inet.gre.wccp", []_C_int{4, 2, 47, 2}},
{"net.inet.icmp.bmcastecho", []_C_int{4, 2, 1, 2}},
{"net.inet.icmp.errppslimit", []_C_int{4, 2, 1, 3}},
{"net.inet.icmp.maskrepl", []_C_int{4, 2, 1, 1}},
{"net.inet.icmp.rediraccept", []_C_int{4, 2, 1, 4}},
{"net.inet.icmp.redirtimeout", []_C_int{4, 2, 1, 5}},
{"net.inet.icmp.stats", []_C_int{4, 2, 1, 7}},
{"net.inet.icmp.tstamprepl", []_C_int{4, 2, 1, 6}},
{"net.inet.igmp.stats", []_C_int{4, 2, 2, 1}},
{"net.inet.ip.arpqueued", []_C_int{4, 2, 0, 36}},
{"net.inet.ip.encdebug", []_C_int{4, 2, 0, 12}},
{"net.inet.ip.forwarding", []_C_int{4, 2, 0, 1}},
{"net.inet.ip.ifq.congestion", []_C_int{4, 2, 0, 30, 4}},
{"net.inet.ip.ifq.drops", []_C_int{4, 2, 0, 30, 3}},
{"net.inet.ip.ifq.len", []_C_int{4, 2, 0, 30, 1}},
{"net.inet.ip.ifq.maxlen", []_C_int{4, 2, 0, 30, 2}},
{"net.inet.ip.maxqueue", []_C_int{4, 2, 0, 11}},
{"net.inet.ip.mforwarding", []_C_int{4, 2, 0, 31}},
{"net.inet.ip.mrtproto", []_C_int{4, 2, 0, 34}},
{"net.inet.ip.mrtstats", []_C_int{4, 2, 0, 35}},
{"net.inet.ip.mtu", []_C_int{4, 2, 0, 4}},
{"net.inet.ip.mtudisc", []_C_int{4, 2, 0, 27}},
{"net.inet.ip.mtudisctimeout", []_C_int{4, 2, 0, 28}},
{"net.inet.ip.multipath", []_C_int{4, 2, 0, 32}},
{"net.inet.ip.portfirst", []_C_int{4, 2, 0, 7}},
{"net.inet.ip.porthifirst", []_C_int{4, 2, 0, 9}},
{"net.inet.ip.porthilast", []_C_int{4, 2, 0, 10}},
{"net.inet.ip.portlast", []_C_int{4, 2, 0, 8}},
{"net.inet.ip.redirect", []_C_int{4, 2, 0, 2}},
{"net.inet.ip.sourceroute", []_C_int{4, 2, 0, 5}},
{"net.inet.ip.stats", []_C_int{4, 2, 0, 33}},
{"net.inet.ip.ttl", []_C_int{4, 2, 0, 3}},
{"net.inet.ipcomp.enable", []_C_int{4, 2, 108, 1}},
{"net.inet.ipcomp.stats", []_C_int{4, 2, 108, 2}},
{"net.inet.ipip.allow", []_C_int{4, 2, 4, 1}},
{"net.inet.ipip.stats", []_C_int{4, 2, 4, 2}},
{"net.inet.mobileip.allow", []_C_int{4, 2, 55, 1}},
{"net.inet.pfsync.stats", []_C_int{4, 2, 240, 1}},
{"net.inet.pim.stats", []_C_int{4, 2, 103, 1}},
{"net.inet.tcp.ackonpush", []_C_int{4, 2, 6, 13}},
{"net.inet.tcp.always_keepalive", []_C_int{4, 2, 6, 22}},
{"net.inet.tcp.baddynamic", []_C_int{4, 2, 6, 6}},
{"net.inet.tcp.drop", []_C_int{4, 2, 6, 19}},
{"net.inet.tcp.ecn", []_C_int{4, 2, 6, 14}},
{"net.inet.tcp.ident", []_C_int{4, 2, 6, 9}},
{"net.inet.tcp.keepidle", []_C_int{4, 2, 6, 3}},
{"net.inet.tcp.keepinittime", []_C_int{4, 2, 6, 2}},
{"net.inet.tcp.keepintvl", []_C_int{4, 2, 6, 4}},
{"net.inet.tcp.mssdflt", []_C_int{4, 2, 6, 11}},
{"net.inet.tcp.reasslimit", []_C_int{4, 2, 6, 18}},
{"net.inet.tcp.rfc1323", []_C_int{4, 2, 6, 1}},
{"net.inet.tcp.rfc3390", []_C_int{4, 2, 6, 17}},
{"net.inet.tcp.rstppslimit", []_C_int{4, 2, 6, 12}},
{"net.inet.tcp.sack", []_C_int{4, 2, 6, 10}},
{"net.inet.tcp.sackholelimit", []_C_int{4, 2, 6, 20}},
{"net.inet.tcp.slowhz", []_C_int{4, 2, 6, 5}},
{"net.inet.tcp.stats", []_C_int{4, 2, 6, 21}},
{"net.inet.tcp.synbucketlimit", []_C_int{4, 2, 6, 16}},
{"net.inet.tcp.syncachelimit", []_C_int{4, 2, 6, 15}},
{"net.inet.udp.baddynamic", []_C_int{4, 2, 17, 2}},
{"net.inet.udp.checksum", []_C_int{4, 2, 17, 1}},
{"net.inet.udp.recvspace", []_C_int{4, 2, 17, 3}},
{"net.inet.udp.sendspace", []_C_int{4, 2, 17, 4}},
{"net.inet.udp.stats", []_C_int{4, 2, 17, 5}},
{"net.inet6.divert.recvspace", []_C_int{4, 24, 86, 1}},
{"net.inet6.divert.sendspace", []_C_int{4, 24, 86, 2}},
{"net.inet6.divert.stats", []_C_int{4, 24, 86, 3}},
{"net.inet6.icmp6.errppslimit", []_C_int{4, 24, 30, 14}},
{"net.inet6.icmp6.mtudisc_hiwat", []_C_int{4, 24, 30, 16}},
{"net.inet6.icmp6.mtudisc_lowat", []_C_int{4, 24, 30, 17}},
{"net.inet6.icmp6.nd6_debug", []_C_int{4, 24, 30, 18}},
{"net.inet6.icmp6.nd6_delay", []_C_int{4, 24, 30, 8}},
{"net.inet6.icmp6.nd6_maxnudhint", []_C_int{4, 24, 30, 15}},
{"net.inet6.icmp6.nd6_mmaxtries", []_C_int{4, 24, 30, 10}},
{"net.inet6.icmp6.nd6_prune", []_C_int{4, 24, 30, 6}},
{"net.inet6.icmp6.nd6_umaxtries", []_C_int{4, 24, 30, 9}},
{"net.inet6.icmp6.nd6_useloopback", []_C_int{4, 24, 30, 11}},
{"net.inet6.icmp6.nodeinfo", []_C_int{4, 24, 30, 13}},
{"net.inet6.icmp6.rediraccept", []_C_int{4, 24, 30, 2}},
{"net.inet6.icmp6.redirtimeout", []_C_int{4, 24, 30, 3}},
{"net.inet6.ip6.accept_rtadv", []_C_int{4, 24, 17, 12}},
{"net.inet6.ip6.auto_flowlabel", []_C_int{4, 24, 17, 17}},
{"net.inet6.ip6.dad_count", []_C_int{4, 24, 17, 16}},
{"net.inet6.ip6.dad_pending", []_C_int{4, 24, 17, 49}},
{"net.inet6.ip6.defmcasthlim", []_C_int{4, 24, 17, 18}},
{"net.inet6.ip6.forwarding", []_C_int{4, 24, 17, 1}},
{"net.inet6.ip6.forwsrcrt", []_C_int{4, 24, 17, 5}},
{"net.inet6.ip6.hdrnestlimit", []_C_int{4, 24, 17, 15}},
{"net.inet6.ip6.hlim", []_C_int{4, 24, 17, 3}},
{"net.inet6.ip6.kame_version", []_C_int{4, 24, 17, 20}},
{"net.inet6.ip6.keepfaith", []_C_int{4, 24, 17, 13}},
{"net.inet6.ip6.log_interval", []_C_int{4, 24, 17, 14}},
{"net.inet6.ip6.maxdynroutes", []_C_int{4, 24, 17, 48}},
{"net.inet6.ip6.maxfragpackets", []_C_int{4, 24, 17, 9}},
{"net.inet6.ip6.maxfrags", []_C_int{4, 24, 17, 41}},
{"net.inet6.ip6.maxifdefrouters", []_C_int{4, 24, 17, 47}},
{"net.inet6.ip6.maxifprefixes", []_C_int{4, 24, 17, 46}},
{"net.inet6.ip6.mforwarding", []_C_int{4, 24, 17, 42}},
{"net.inet6.ip6.mrtproto", []_C_int{4, 24, 17, 8}},
{"net.inet6.ip6.mtu", []_C_int{4, 24, 17, 4}},
{"net.inet6.ip6.multicast_mtudisc", []_C_int{4, 24, 17, 44}},
{"net.inet6.ip6.multipath", []_C_int{4, 24, 17, 43}},
{"net.inet6.ip6.neighborgcthresh", []_C_int{4, 24, 17, 45}},
{"net.inet6.ip6.redirect", []_C_int{4, 24, 17, 2}},
{"net.inet6.ip6.rr_prune", []_C_int{4, 24, 17, 22}},
{"net.inet6.ip6.sourcecheck", []_C_int{4, 24, 17, 10}},
{"net.inet6.ip6.sourcecheck_logint", []_C_int{4, 24, 17, 11}},
{"net.inet6.ip6.use_deprecated", []_C_int{4, 24, 17, 21}},
{"net.inet6.ip6.v6only", []_C_int{4, 24, 17, 24}},
{"net.key.sadb_dump", []_C_int{4, 30, 1}},
{"net.key.spd_dump", []_C_int{4, 30, 2}},
{"net.mpls.ifq.congestion", []_C_int{4, 33, 3, 4}},
{"net.mpls.ifq.drops", []_C_int{4, 33, 3, 3}},
{"net.mpls.ifq.len", []_C_int{4, 33, 3, 1}},
{"net.mpls.ifq.maxlen", []_C_int{4, 33, 3, 2}},
{"net.mpls.mapttl_ip", []_C_int{4, 33, 5}},
{"net.mpls.mapttl_ip6", []_C_int{4, 33, 6}},
{"net.mpls.maxloop_inkernel", []_C_int{4, 33, 4}},
{"net.mpls.ttl", []_C_int{4, 33, 2}},
{"net.pflow.stats", []_C_int{4, 34, 1}},
{"net.pipex.enable", []_C_int{4, 35, 1}},
{"user.bc_base_max", []_C_int{8, 2}},
{"user.bc_dim_max", []_C_int{8, 3}},
{"user.bc_scale_max", []_C_int{8, 4}},
{"user.bc_string_max", []_C_int{8, 5}},
{"user.coll_weights_max", []_C_int{8, 6}},
{"user.cs_path", []_C_int{8, 1}},
{"user.expr_nest_max", []_C_int{8, 7}},
{"user.line_max", []_C_int{8, 8}},
{"user.posix2_c_bind", []_C_int{8, 11}},
{"user.posix2_c_dev", []_C_int{8, 12}},
{"user.posix2_char_term", []_C_int{8, 13}},
{"user.posix2_fort_dev", []_C_int{8, 14}},
{"user.posix2_fort_run", []_C_int{8, 15}},
{"user.posix2_localedef", []_C_int{8, 16}},
{"user.posix2_sw_dev", []_C_int{8, 17}},
{"user.posix2_upe", []_C_int{8, 18}},
{"user.posix2_version", []_C_int{8, 10}},
{"user.re_dup_max", []_C_int{8, 9}},
{"user.stream_max", []_C_int{8, 19}},
{"user.tzname_max", []_C_int{8, 20}},
{"vm.anonmin", []_C_int{2, 7}},
{"vm.loadavg", []_C_int{2, 2}},
{"vm.maxslp", []_C_int{2, 10}},
{"vm.nkmempages", []_C_int{2, 6}},
{"vm.psstrings", []_C_int{2, 3}},
{"vm.swapencrypt.enable", []_C_int{2, 5, 0}},
{"vm.swapencrypt.keyscreated", []_C_int{2, 5, 1}},
{"vm.swapencrypt.keysdeleted", []_C_int{2, 5, 2}},
{"vm.uspace", []_C_int{2, 11}},
{"vm.uvmexp", []_C_int{2, 4}},
{"vm.vmmeter", []_C_int{2, 1}},
{"vm.vnodemin", []_C_int{2, 9}},
{"vm.vtextmin", []_C_int{2, 8}},
}