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