4 #################################################################
6 # It would be nice to have OIDs separated into composite groups
7 # using the subsection mdoc(7) feature (.Ss) without adding extra
10 # The ability to notice when new OIDs are added to FreeBSD, and
11 # and the automation of their sorting and addition into the
14 # Perhaps a re-implementation in C? This wouldn't be much of
15 # a challenge for the right individual but it may require a lot
16 # of changes to sysctl.h. Eventually this utility should replace
17 # documenting sysctls in code and manual pages since this utility
18 # creates a manual page dynamicly based on the kernel. This
19 # would kill duplication between manual pages and kernel code as
20 # well as improve the removal of sysctls when they are obsoleted.
21 #################################################################
24 PATH=/bin:/usr/bin:/sbin:/usr/sbin
26 # Set a unique date format in the produced manual page.
27 DATE=`LC_TIME=C date +"%B %d, %Y"`
29 # We need a usage statement correct?
30 USAGE="Usage: run.sh -k [absolute path]"
32 # The endman function closes the list and adds the bottom
33 # part of our manual page.
35 cat <<EOF>> ./sysctl.5
37 .Sh IMPLEMENTATION NOTES
38 This manual page has been automatically generated by
39 a set of scripts written in
43 markup is stored in the database file and extracted
44 accordingly when invoked.
45 For information on the
47 implementation, see the respecting manual pages.
55 .Xr sysctl_add_oid 9 ,
58 This manual page is automatically generated
59 by a set of scripts written by
61 .An Tom Rhodes Aq Mt trhodes@FreeBSD.org ,
62 with significant contributions from
63 .An Giorgos Keramidas Aq Mt keramida@FreeBSD.org ,
64 .An Ruslan Ermilov Aq Mt ru@FreeBSD.org ,
66 .An Marc Silver Aq Mt marcs@draenor.org .
71 can be left undocumented by those who originally
73 This script was forged as a way to automatically
74 produce a manual page to aid in the administration and
78 It also gets around adding a bunch of supporting code to the
84 # The markup_create() function builds the actual
85 # markup file to be dropped into. In essence,
86 # compare our list of tunables with the documented
87 # tunables in our tunables.mdoc file and generate
88 # the final 'inner circle' of our manual page.
91 xargs -n 1 /bin/sh ./sysctl.sh \
97 # Finally, the following lines will call our functions and
98 # and create our document using the following function:
101 /bin/cat ./markup.file >> sysctl.5
105 # The startman function creates the initial mdoc(7) formatted
106 # manual page. This is required before we populate it with
107 # tunables both loader and sysctl(8) oids.
109 cat <<EOF>> ./sysctl.5
111 .\" Copyright (c) 2005 Tom Rhodes
112 .\" All rights reserved.
114 .\" Redistribution and use in source and binary forms, with or without
115 .\" modification, are permitted provided that the following conditions
117 .\" 1. Redistribution of source code must retain the above copyright
118 .\" notice, this list of conditions and the following disclaimer.
119 .\" 2. Redistribution's in binary form must reproduce the above copyright
120 .\" notice, this list of conditions and the following disclaimer in the
121 .\" documentation and/or other materials provided with the distribution.
123 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
124 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
125 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
126 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
127 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
128 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
129 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
130 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
131 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
132 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
141 .Nd "list of available syctls based on kernel configuration"
144 supports kernel alterations on the fly or at
145 system initialization by using a feature
149 Many values may be altered simply by using the
151 utility followed by a
153 and its new value at the command prompt.
155 .Dl sysctl kern.ipc.zero_copy.receive=1
156 will enable zero copy sockets for receive.
158 Many variables may only be available if specific kernel
159 options are built into the kernel.
160 For example, the previous
165 Most of these values only offer an enable/disable
166 option, altered by using a numerical value of
170 where the former is disable and latter is enable.
173 may require a string value.
176 utility may be used to dump a list of current
177 values which should provide an example of
178 the non-numeric cases.
180 In cases where the value may not be altered, the
181 following warning will be issued:
186 To alter these values, the administrator may place
190 This will invoke the changes during
191 system initialization for those values
192 which may be altered.
196 Then again, some of these
198 may never be altered.
206 .Bl -ohang -offset indent
211 # The nm(1) utility must only be used on the architecture which
212 # we build it for. Although i386 is so; my only fear
213 # with this is that this will not work properly on cross-builds.
215 while getopts k FLAG;
219 k) LOCATION="$OPTARG" ;;
230 if [ -z "$1" ] && [ -z "$LOCATION" ] ;
231 then echo "Malformed or improper path specified";
235 if [ -z "$LOCATION" ] ;
237 && for x in `find $LOCATION -name '*.kld'` \
240 sed -n '/sysctl___/ {
241 's/[\.a-z_]*sysctl___//g'