Added sysctl examples (read-only sysctls for now)

This commit is contained in:
bgrayson 2000-01-17 07:22:45 +00:00
parent 4760c9fa1b
commit 2a09ca64fd
3 changed files with 38 additions and 0 deletions

View File

@ -86,3 +86,25 @@ NoticeNoSlashHere
# Or, rather than putting //, we can use the last nroff
# configuration, nroff%, instead:
% cat /p/nroff%/p/bzcat%/usr/share/man/man8/mount_portal.bz2
# Also, we can provide read-only 'sysctlfs' functionality. This
# is provided by the shell script sysctlfs.sh, which should be in
# /usr/share/examples/mount_portal.
% cat /p/sysctl/kern.mbuf
msize = 128
mclbytes = 2048
nmbclusters = 512
mblowat = 16
mcllowat = 8
% cat /p/sysctl/kern/mbuf
msize = 128
mclbytes = 2048
nmbclusters = 512
mblowat = 16
mcllowat = 8
% cat /p/sysctl/kern/mbuf/msize
128

View File

@ -16,3 +16,4 @@ bzcat/ rfilter bzcat/ bzcat %s
bzcat% rfilter bzcat% bzcat %s
nroff/ rfilter nroff/ nroff -man %s
nroff% rfilter nroff% nroff -man %s
sysctl/ rfilter sysctl/ /usr/share/examples/mount_portal/sysctlfs.sh %s

View File

@ -0,0 +1,15 @@
#!/bin/sh
## $NetBSD: sysctlfs.sh,v 1.1 2000/01/17 07:22:45 bgrayson Exp $
## Fast hack at a sysctl filesystem. The path can be either in
## dot-style (kern.mbuf.msize) or in slash-style (kern/mbuf/msize).
## Hacked as an example by Brian Grayson (bgrayson@netbsd.org) in Sep 1999.
for path in $*; do
## First, change any slashes into dots.
path=`echo $path | tr '/' '.'`
## Now invoke sysctl, and post-process the output to make it
## friendlier. In particular:
## 1. Remove the leading prefix.
## 2. Remove a now-leading ".", if any.
## 3. If we are left with " = <val>", strip out the " = " also.
sysctl $path | sed -e "s/$path//;s/^\.//;s/^ = //"
done