Home | History | Annotate | Download | only in sysctl
History log of /src/sbin/sysctl/sysctl.c
RevisionDateAuthorComments
 1.165  02-Apr-2023  ryo commonize case block
 1.164  02-Apr-2023  ryo don't pass add=1 to print_tree() when displaying by specifying nodes.

For example, "sysctl -w kern.mbuf=" had been displayed extra node names in the MIB.
# sysctl -w kern.mbuf=
kern.mbuf.mbuf.msize = 512
kern.mbuf.mbuf.mclbytes = 2048
:
 1.163  28-Dec-2021  christos kern.hashstat takes too long and it is meaningless here.
 1.162  18-Aug-2019  kamil sysctl: Add indirection of symbols to remove clash with sanitizers

Add indirection and symbol renaming under MKSANITIZER for the linked in
version of sysctlbyname and sysctlgetmibinfo.
 1.161  30-Oct-2018  kre branches: 1.161.2;
kern.boottime was changed from a struct timeval to a struct timespec
in January 2009 (the Christos' time merge, when time_t went to 64 bits).

sysctl needs to catch up. (So do other progs, which will happen, eventually,
but most of them are unaffected in any practical way.)

If you are running a system (NetBSD 6 or later) without this change, try
sysctl -nn kern.boottime
and marvel at the result (in theory, seconds.microseconds) most
probably being something like:
jinx$ sysctl -nn kern.boottime
1540801874.999995564
(There is a 1 in 1000 chance your system will have booted
in the interval [0 , 999999] nanoseconds after some second,
in which case this will not be observed. You should get
(almost) the same value after this change - just now it is as
it should be (there should now always be 9 digits after the '.').

On the other hand, if you're on a big-endian 64 bit host (running
64 bit sysctl) you would have always seen 0 for the microseconds field.
That should be fixed by this.

In sysctl(7) also document what we mean by "the time the system booted".

XXX Pullup -8
XXX Pullup -7
XXX Pullup -6 (oops, missed that one...)
 1.160  04-Feb-2018  mrg branches: 1.160.2; 1.160.4;
updates for GCC 6.4:

identd has aliasing violations, use -fno-strict-aliasing.

newfs_msdos's getbpbinfo() has missing {} issues.

sysctl's kern_cp_id() has missing {} issues.
 1.159  13-Apr-2017  christos say ipsec stats are viewable with netstat.
 1.158  31-Jul-2016  dholland branches: 1.158.2;
Apply patch from PR 43587, mostly from martin and kre. When writing a
sysctl variable using ?= fails with EPERM, don't print an error
message.

Ideally setting a sysctl to the same value it already has should also
not fail regardless of permissions, but this would need to be done in
the kernel.
 1.157  13-Dec-2015  christos branches: 1.157.2;
mention ip6addrctl
 1.156  17-Aug-2015  knakahara Add intrctl(8).
 1.155  09-Nov-2014  christos remove debugging
 1.154  09-Nov-2014  christos add handler for /kern/evcnt and print the actual error when failing.
 1.153  16-May-2014  martin Get rid of all sysc_init_field uses - initialize fields directly in C99
notation.
 1.152  16-May-2014  martin Do not loop over children if a node is not marked as CTLTYPE_NODE.
 1.151  10-Jan-2014  christos branches: 1.151.2;
use __func__, EXIT_{SUCCESS,FAILURE}
 1.150  10-Jan-2014  pooka give err() some reason to avoid:
sysctl.c:2713:5: error: zero-length gnu_printf format string [-Werror=format-zero-length]
 1.149  13-Dec-2012  msaitoh Add missing free() in error path.
 1.148  07-Dec-2012  christos use __BITMAP_TYPE
 1.147  05-Dec-2012  christos fix bug found by clang.
 1.146  01-Dec-2012  christos switch from fd_set to bitmap macros, by popular demand.
 1.145  29-Nov-2012  christos put back line I accidentally deleted.
 1.144  29-Nov-2012  christos add a handler for the reserved port sysctl variable.
 1.143  02-Jun-2012  dsl branches: 1.143.2;
Add support for unsigned decimal values.
 1.142  15-Mar-2012  joerg Add __printflike attribution to use vprintf and friends with an argument
as format string.
 1.141  11-Mar-2012  christos PR/44961: Jukka Ruohonen: for sysctl's with built-in handlers, return OPNOTSUPP
if we don't have handlers instead of using the handler we have and silently
failing on attempts to write a node that cannot be written.
 1.140  12-Feb-2012  christos branches: 1.140.2;
Only print errors when -A or required. Fix the error message to match others.
 1.139  04-Jan-2012  drochner include <netipsec/ipsec.h> rather than <netinet6/ipsec.h> from userland
where possible, for consistency and compatibility to FreeBSD
(exception: KAME specific statistics gathering in netstat(1) and systat(1))
 1.138  29-Aug-2011  joerg branches: 1.138.2;
Use __dead
 1.137  24-Aug-2011  christos Instead of using strncat and re-scanning the strings all the time, use and
append printf function.
 1.136  03-Aug-2011  christos no -A or -a with -q
 1.135  03-Aug-2011  christos allow -q flag to work for reads.
 1.134  16-Apr-2011  christos PR/44864: Paul Ripke: Compile regular expressions on demand and only once.
 1.133  13-Dec-2010  pooka RUMP_ACTION -> RUMPPRG
 1.132  05-Nov-2010  pooka make sysctl(8) work as a rump client
 1.131  11-Apr-2010  mrg implement CTLTYPE_BOOL support. it was entirely missing. HI MATT!
 1.130  30-Sep-2009  elad Remove stale references to the "read only at securelevel [12]" flags in
the documentation and code comments.
 1.129  01-Apr-2009  christos Don't print an error with sysctl -w name?=value if name does not exist.
Should be pulled up to 5.0
 1.128  20-Mar-2009  lukem fix sign-compare issues
 1.127  18-Mar-2009  pgoyette Format the address/offset of hexdump in hex, not decimal.

Addresses my PR bin/41035
 1.126  05-Mar-2009  njoly Add missing free() in machdep_diskinfo().
 1.125  28-Dec-2008  christos branches: 1.125.2;
fix dev_t format.
 1.124  20-Jul-2008  lukem branches: 1.124.2;
Remove the \n and tabs from the __COPYRIGHT() strings.
(Tweak some to use a consistent format.)
 1.123  29-Apr-2008  martin branches: 1.123.2;
Convert to new 2 clause license
 1.122  21-Dec-2006  elad branches: 1.122.12; 1.122.14;
PR/35304: C J Coleman: Off-by-one nul byte overwrite in mode_bits routine
of sbin/sysctl
 1.121  18-Dec-2006  christos Exit with non-zero on errors.
 1.120  02-Nov-2006  christos branches: 1.120.2;
PR/34965: Nicolas Joly: sysctl(1) small memory leak
 1.119  01-Nov-2006  christos prefix name in kern.drivers
 1.118  15-Oct-2006  christos support printing kern.drivers
 1.117  30-Jul-2006  elad CTLFLAG_READONLY1 and CTLFLAG_READONLY2 were deprecated in earlier commit, remove them here too
 1.116  14-Jul-2006  elad move security.setid_core.* to kern.coredump.setid.*, as requested by yamt@.
 1.115  30-Mar-2006  jnemeth Coverity CID 2784: Add more checks for value==NULL.
 1.114  26-Mar-2006  christos Coverity CID 2763: Add more checks for value==NULL.
 1.113  26-Mar-2006  christos Coverity CID 2764: Avoid null reference
 1.112  22-Mar-2006  christos Coverity CID 786: Avoid NULL dereference.
 1.111  08-Feb-2006  christos detect integer overflow differently. previous change broke negative sysctl
values.
 1.110  05-Feb-2006  christos PR/17441: John F. Woods: integer sysctl does not accept numbers > 0x7fffffff
Use unsigned int in the range comparison, and use strerror() instead of
home brewed error strings.
 1.109  02-Feb-2006  elad - make use of the recently added mode_bits for security.setid_core.mode;
- document setid_core variables.
 1.108  02-Feb-2006  elad add support for parsing file mode bits.

when printed, you'll see something like "0600 (rw-------)", like the
ls output. when reading input you can either specify octal mode (0600)
or chmod-like (u=rw).

ideas from atatat@ and kjk@; okay and lots of help from atatat@.
 1.107  06-Sep-2005  rpaulo Handle net.inet.tcp.debug, net.inet.tcp.debx, net.ns.spp.debug and
net.ns.spp.debx. Bump man page date.
 1.106  28-Aug-2005  rpaulo net.inet?.*.stats are viewable with netstat(1).
 1.105  04-Aug-2005  rpaulo Inform the user that net.bpf.stats and net.bpf.peers are viewable with
netstat(1).
 1.104  27-Jun-2005  christos Move WARNS=3 to the Makefile.inc, and add a little const to the remaining
programs that did not compile before.
 1.103  16-Jun-2005  christos Add code to handle cp_id. From atatat.
 1.102  06-Apr-2005  christos PPR/29909: Manuel Bouyer: sysctl dumps core if kern.consdev returns unknown
device. If we cannot determine the device name of the console, print the
console dev_t in hex.
 1.101  28-Mar-2005  christos make sysctl -n print the real console tty name and -nn print the numeric
value.
XXX: -n means don't print name, not numeric. We should stop overloading
it and use a different flag.
 1.100  23-Mar-2005  atatat If a "create" or "destroy" operation succeeds, mark the cached tree as
"stale" so that the next time we try to read or write to it, we can
purge (and refresh) it.

Addresses PR 29222.
 1.99  19-Mar-2005  atatat Fix possible segmentation fault when retrieving descriptions. Thought
I committed this a while ago. I guess the fact that no one filed a pr
meant no one else found it. :)
 1.98  18-Mar-2005  atatat Use regexes instead of static lists of annoying numbers to recognize
sysctl nodes that have "helpers". This is more concise, imho more
easy to understand, and has the added bonus of making it *possible* to
assign helpers to dynamically numbered nodes.
 1.97  15-Mar-2005  atatat branches: 1.97.2;
Make requestors of kern.file2 be referred to pstat (the same as
kern.file) and add EINVAL to the list of errno values which are
silently ignored when walking the tree.
 1.96  17-Dec-2004  atatat Pass dynamic buffer pointer to display_string(), not static buffer
pointer. Causes...misfunction if the kernel says the buffer needs to
be too much larger.
 1.95  17-Oct-2004  jdolecek constify handlers[]
 1.94  25-Apr-2004  atatat When converting a string to a number, also make sure that you didn't
convert an empty string to a zero.

Follow on to PR bin/25115 in private email.
 1.93  23-Apr-2004  atatat Allocate adjusted size, not fixed size.
 1.92  22-Apr-2004  atatat Some lint cleaning, strip leading (and sometimes trailing) whitespace
from values to be assigned when processing a file. Clean up error
reporting (print the name of the file and the line number), and tidy
some numeric conversions. Continue after most "errors" when
processing a -f argument.

Addresses PR bin/25115.
 1.91  14-Apr-2004  atatat If the node was specifically requested but has no description, print
the "no description" message instead of skipping (as happens when
recursing into a subtree). This does not apply to non-node-type
nodes.
 1.90  08-Apr-2004  atatat Don't copy the size that sysctl gave back directly, copy the size of
the description. *thwap*
 1.89  08-Apr-2004  atatat Don't copy the size that sysctl gave back directly, copy the size of
the description.
 1.88  08-Apr-2004  atatat Do nothing else for nodes with no children if -d is used (dflag is
set). Otherwise, some nodes (those with "printers") will also print
the "use foo ..." message.
 1.87  06-Apr-2004  atatat Add -d flag to usage message(s).
 1.86  26-Mar-2004  he branches: 1.86.2;
Make this too gcc2-compileable.
 1.85  25-Mar-2004  atatat Move sysctlbyname(), sysctlnametomib(), and sysctlgetmibinfo() from
sysctl(8) into libc, making the minor number jump. Add prototypes to
sys/sysctl.h, fix sets, modify man pages, etc. That oughta cover it.
 1.84  24-Mar-2004  atatat Implement sysctl descriptions. Now all that remains is actually to
write them.
 1.83  24-Mar-2004  atatat Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.
 1.82  20-Mar-2004  atatat A little syntactic sugar
 1.81  20-Feb-2004  atatat Make this:

% sysctl -A kern.cp_time

(and also "sysctl -A" without the kern.cp_time argument) print this:

kern.cp_time: user = 851648, nice = 683496, sys = 69383, ...
kern.cp_time.0: user = 85648, nice = 68496, sys = 6983, ...
...

instead of just:

kern.cp_time.0: user = 85648, nice = 68496, sys = 6983, ...
...
 1.80  19-Feb-2004  atatat More better display of kern.cp_time for MP machines. Now we use one
sysctl() call to query for each of three different display modes:

(1) sum across all cpus

% sysctl kern.cp_time
kern.cp_time: user = 93240, nice = 1507, sys = 17252, ...

(2) data for just cpu 0

% sysctl kern.cp_time.0
kern.cp_time.0: user = 93282, nice = 1507, sys = 17264, ...

(3) each cpu individually up to hw.ncpu

% sysctl -A kern.cp_time
kern.cp_time.0: user = 93349, nice = 1507, sys = 17280, ...
kern.cp_time.1: user = 93403, nice = 1507, sys = 17291, ...
...
 1.79  19-Feb-2004  atatat Miscellaneous display bugfixes.
 1.78  19-Feb-2004  atatat Rename sysctlnametomib() to sysctlgetmibinfo() and add FreeBSD
compatible sysctlnametomib() and sysctlbyname() functions.

These are intended to move to libc real soon now.
 1.77  05-Jan-2004  jmmv Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.
 1.76  04-Dec-2003  atatat sysctlnametomib() is a private function for the moment.
 1.75  04-Dec-2003  atatat New sysctl(8) binary. Performs auto-discovery and can add/remove
nodes from the tree. Never needs to be recompiled again.
 1.74  10-Nov-2003  jonathan Make per-protocol network input queue stats visible to userland via
sysctl. Add a protocol-independent sysctl handler to show the per-protocol
"struct ifq' statistics. Add IP(v4) specific call to the handler.
Other protocols can show their per-protocol input statistics by
allocating a sysclt node and calling sysctl_ifq() with their own struct ifq *.

As posted to tech-kern plus improvements/cleanup suggested by Andrew Brown.
 1.73  21-Sep-2003  wiz Combine multiple single-letter options.
 1.72  20-Sep-2003  grant add -e flag to set the separator to '=' where the default is ' = '.
this allows sysctl output to fed back into itself. inspired by
FreeBSD's sysctl(8).

ok'd by atatat.
 1.71  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22308, verified by myself.
 1.70  17-Jun-2003  simonb Remove the KERN_DRIVERS case handler (prototype code?).
 1.69  16-Jun-2003  dsl Print hw.cnmagic as escaped hex bytes (unless -n given).
Change 'special' to be a numeral not a bit, it isn't ever used as a bit
and I can't see why it should ever be used that way.
 1.68  31-May-2003  thorpej Avoid a strict-alias warning in gcc 3.3.
 1.67  18-May-2003  itojun simplify more
 1.66  18-May-2003  itojun simplify by strlcpy/cat
 1.65  06-Apr-2003  lukem Tweak behaviour introduced in rev 1.50;
* by default, warning messages go to stderr
* if -A or -a is used, send warning messages to stdout instead.

The behaviour in 1.50 meant that
somevar=`sysctl -n machdep.booted_kernel 2>/dev/null`
could end up with $somevar="machdep.booted_kernel: the value is not available"
rather than the more useful $somevar="".

(This way, "sysctl -A | grep ..." is still useful.)
 1.64  07-Mar-2003  fvdl Quell formwat warning for LP64 for the diskinfo printf.
 1.63  22-Jan-2003  dsl display machdep.diskinfo for i386 and x86_84
(agreed by christos)
 1.62  24-Dec-2002  manu On Darwin, mach_init is the system bootstrap process. It is responsible
for forking the traditional UNIX init(8) and it does the Mach port naming
service. We need mach_init for the naming service, but unfortunately, it
will only act as such if its PID is 1. We introduce a sysctl
(emul.darwin.init_pid) to fool a given process into thinking its PID is 1.
That way we can get mach_init into behaving as the name server.

Typical use:
/sbin/sysctl -w emul.darwin.init_pid=$$ ; exec /emul/darwin/sbin/mach_init
 1.61  30-Nov-2002  lukem tweaks for fparseln(3) move from libutil to libc:
- remove #include <util.h> if nothing else needed it
- remove LDFLAGS+=-lutil if nothing else needed it
 1.60  09-Nov-2002  manu Added sysctl to change all IRIX kernel values reported by uname and systeminfo:
OS name, hw name, kernel version, and so forth.
 1.59  03-Nov-2002  simonb When printing out nodes of type "string", don't print anything if
sysctl() reports that 0 bytes were returned.

Reported by Matt Green with "sysctl hw.disknames" on a system with no
disks.
 1.58  24-Mar-2002  sommerfeld branches: 1.58.2;
Add -q flag, for use with -w and -f, which suppresses output after a set.
 1.57  20-Mar-2002  christos remove debugging line.
 1.56  20-Mar-2002  christos handle new emulation sysctls, and cleanup function duplication.
 1.55  31-Jan-2002  christos fix inconsistencies with USEAPP; centralize the flags check so that we
don't have to deal with it in the future.
 1.54  28-Jan-2002  simonb Descend into kern.tkstat.
 1.53  28-Jan-2002  simonb ANSIfy.
 1.52  27-Jan-2002  simonb Fix a tyop in a comment.
 1.51  27-Jan-2002  simonb Teach sysctl(8) that hw.diskstats is a structure.
 1.50  24-Dec-2001  lukem change a lot of the "error" messages to display to stdout instead of
stderr, so that "sysctl -A" output is actually usable. requested by perry
 1.49  27-Jul-2001  itojun show net.inet6.tcp6.* as mirror image of net.inet.tcp. better for future
INET-less kernels.
 1.48  02-Jul-2001  jdolecek pipe sysctl stuff is now in <sys/pipe.h>
 1.47  16-Jun-2001  jdolecek Add port of high performance pipe implementation written by John S. Dyson
for FreeBSD project. Besides huge speed boost compared with socketpair-based
pipes, this implementation also uses pagable kernel memory instead of mbufs.

Significant differences to FreeBSD version:
* uses uvm_loan() facility for direct write
* async/SIGIO handling correct also for sync writer, async reader
* limits settable via sysctl, amountpipekva and nbigpipes available via sysctl
* pipes are unidirectional - this is enforced on file descriptor level
for now only, the code would be updated to take advantage of it
eventually
* uses lockmgr(9)-based locks instead of home brew variant
* scatter-gather write is handled correctly for direct write case, data
is transferred by PIPE_DIRECT_CHUNK bytes maximum, to avoid running out of kva

All FreeBSD/NetBSD specific code is within appropriate #ifdef, in preparation
to feed changes back to FreeBSD tree.

This pipe implementation is optional for now, add 'options NEW_PIPE'
to your kernel config to use it.
 1.46  09-Mar-2001  chs add UBC memory-usage balancing. we track the number of pages in use for
each of the basic types (anonymous data, executable image, cached files)
and prevent the pagedaemon from reusing a given page if that would reduce
the count of that type of page below a sysctl-setable minimum threshold.
the thresholds are controlled via three new sysctl tunables:
vm.anonmin, vm.vnodemin, and vm.vtextmin. these tunables are the
percentages of pageable memory reserved for each usage, and we do not allow
the sum of the minimums to be more than 95% so that there's always some
memory that can be reused.
 1.45  19-Feb-2001  cgd convert to use getprogname()
 1.44  04-Feb-2001  christos fix nested extern.
 1.43  09-Jan-2001  fvdl Number of toplevel names grew by one, account for it.
 1.42  05-Jan-2001  lukem use %ll_ instead of the less standard %q_
 1.41  19-Jul-2000  enami Free storage allocated by fparseln.
 1.40  15-Jul-2000  simonb Handle KERN_MSGBUF and KERN_CONSDEV gracefully.
 1.39  15-Jul-2000  itojun sync with sys/sysctl.h change (is it the right way to workaround this?)
 1.38  26-Jun-2000  mrg we now need <uvm/uvm_param.h>
 1.37  07-Jun-2000  itojun branches: 1.37.2;
s/PIMCTL/PIM6CTL/ to avoid future confusion.
 1.36  29-May-2000  matt LP64 format problems. u_int64_t on alpha != %llu
 1.35  29-May-2000  simonb cp_time[] is an array of u_int64_t's now.
 1.34  27-May-2000  simonb branches: 1.34.2;
Handle kern.proc_args as well.
 1.33  27-May-2000  simonb s/fprintf(stdout/printf(/
 1.32  27-May-2000  simonb Deal with new structure returning sysctl()s.
 1.31  21-Apr-2000  simonb Fix minor annoyance - when showing the boottime, the ctime() result
already has a trailing newline, so don't add an extra one.
 1.30  14-Apr-2000  simonb Don't declare 'extern opt*' getopt variables.
 1.29  08-Apr-2000  soren Update usage with -f.
 1.28  12-Mar-2000  tsarna Fix warning.
 1.27  12-Mar-2000  tsarna Add a "-f file" flag to process directives from a file.
 1.26  17-Feb-2000  fvdl List vfs.generic.usermount in manpage. Don't try to handle machdep.diskinfo
for the i386, thus avoiding a warning message in 'sysctl -a'.
 1.25  12-Feb-2000  thorpej Support vm.nkmempages.
 1.24  06-Feb-2000  itojun fix include file path.
 1.23  17-Jan-2000  itojun Moved from usr.sbin/sysctl/sysctl.c,v
 1.22  28-Sep-1999  bouyer Add handling of the proc hierarchy. Document it, as well as kern.defcorename.
 1.21  30-Jul-1999  itojun branches: 1.21.2;
do not include sys/netinet6/in6_systm.h, this has been empty.
 1.20  02-Jul-1999  itojun IPv6/IPsec sysctl MIB support.
 1.19  26-Apr-1999  thorpej Add support for kern.mbuf.*
 1.18  13-Nov-1998  thorpej Direct the user to use nfsstat to print nfs statistics.
 1.17  13-Nov-1998  thorpej Implement support for the vfs. toplevel.
 1.16  11-Mar-1998  thorpej Fix typos lossage on the Alpha.
 1.15  05-Mar-1998  tron Include unistd.h to import declaration of getopt(3)
 1.14  05-Mar-1998  christos WARNSify
 1.13  01-Mar-1998  fvdl Merge with Lite2 + local changes
 1.12  06-Feb-1998  jonathan Tell user to use xnptdc to view kern.ntptime, as a workaround until
sysctl and libntp agree about "progname".
Based on a patch suggested by Soren S. Jorvang <soren@t.dk> in PR bin/4433.
 1.11  01-Nov-1997  lukem getopt returns -1 not EOF
 1.10  09-Jan-1997  thorpej Grok and document CTL_DDB.
 1.9  30-Sep-1995  thorpej New-style RCS ids.
 1.8  30-Sep-1995  thorpej Add support for the net.inet.tcp sysctl group and document. From
John Kohl <jtk@kolvir.blrc.ma.us>.
 1.7  07-Jun-1995  cgd typeof(timeval.tv_sec) != time_t
 1.6  02-Jun-1995  pk Correct argument in error msg. (PR #1087)
 1.5  23-Dec-1994  cgd be safe with types
 1.4  18-Sep-1994  mycroft Print tickadj.
 1.3  13-May-1994  cgd re-enable net sysctl code
 1.2  09-May-1994  cgd punt networking goo for now
 1.1  09-May-1994  cgd branches: 1.1.1;
Initial revision
 1.1.1.2  01-Mar-1998  fvdl Import 4.4BSD-Lite2
 1.1.1.1  09-May-1994  cgd sysctl-of-fish
 1.21.2.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.34.2.1  22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.37.2.4  10-Nov-2002  itojun sbin/sysctl/sysctl.c 1.59

When printing out nodes of type "string", don't print anything if
sysctl() reports that 0 bytes were returned. Reported by Matt Green.

(simonb)
 1.37.2.3  22-Jul-2000  simonb Pull up rev 1.40:
Handle KERN_MSGBUF and KERN_CONSDEV gracefully.
 1.37.2.2  22-Jul-2000  enami Pullup revision 1.41 (requested by thorpej):
Free storage allocated by fparseln.
 1.37.2.1  15-Jul-2000  itojun pullup 1.38 -> 1.39 (requested by releng-1-5)
sync with sys/sysctl.h change (constify)
 1.58.2.1  15-Nov-2002  lukem Pull up revision 1.59 (requested by simon in ticket #958):
When printing out nodes of type "string", don't print anything if
sysctl() reports that 0 bytes were returned.
Reported by Matt Green with "sysctl hw.disknames" on a system with no
disks.
--
 1.86.2.10  28-Apr-2004  jmc branches: 1.86.2.10.2;
Pullup rev 1.94 (requested by atatat in ticket #192)

When converting a string to a number, also make sure that you didn't
convert an empty string to a zero. PR#25115
 1.86.2.9  26-Apr-2004  jdc Pull up revision 1.93 (requested by atatat in ticket #181)

Allocate adjusted size, not fixed size.
 1.86.2.8  22-Apr-2004  tron Pull up revision 1.92 (requested by atatat in ticket #174):
Some lint cleaning, strip leading (and sometimes trailing) whitespace
from values to be assigned when processing a file. Clean up error
reporting (print the name of the file and the line number), and tidy
some numeric conversions. Continue after most "errors" when
processing a -f argument.
Addresses PR bin/25115.
 1.86.2.7  16-Apr-2004  tron Pull up revision 1.91 (requested by atatat in ticket #136):
If the node was specifically requested but has no description, print
the "no description" message instead of skipping (as happens when
recursing into a subtree). This does not apply to non-node-type
nodes.
 1.86.2.6  08-Apr-2004  jdc Pull up revision 1.90 (requested by atatat in ticket #94)

Don't copy the size that sysctl gave back directly, copy the size of
the description. *thwap*
 1.86.2.5  08-Apr-2004  jdc Pull up revision 1.89 (requested by atatat in ticket #92)

Don't copy the size that sysctl gave back directly, copy the size of
the description.
 1.86.2.4  08-Apr-2004  jdc Backout previous. It contained the changes for both
tickets #92 and #94 (instead of just #92).
 1.86.2.3  08-Apr-2004  jdc Pull up revision 1.89 (requested by atatat in ticket #92)

Don't copy the size that sysctl gave back directly, copy the size of
the description.
 1.86.2.2  08-Apr-2004  jdc Pull up revision 1.88 (requested by atatat in ticket #88)

Do nothing else for nodes with no children if -d is used (dflag is
set). Otherwise, some nodes (those with "printers") will also print
the "use foo ..." message.
 1.86.2.1  07-Apr-2004  jmc Pullup rev 1.87 (requested by atatat in ticket #81)

Add -d flag to usage message(s).
 1.86.2.10.2.1  06-Apr-2005  he Pull up revision 1.96 (requested by atatat in ticket #1048):
Pass dynamic buffer pointer to display_string(), not static
buffer pointer. This fixes a problem if the kernel says the
buffer needs to be too much larger.
 1.97.2.3  23-Mar-2005  tron Pull up revision 1.100 (requested by atatat in ticket #52):
If a "create" or "destroy" operation succeeds, mark the cached tree as
"stale" so that the next time we try to read or write to it, we can
purge (and refresh) it.
Addresses PR 29222.
 1.97.2.2  20-Mar-2005  tron Pull up revision 1.99 (requested by atatat in ticket #36):
Fix possible segmentation fault when retrieving descriptions. Thought
I committed this a while ago. I guess the fact that no one filed a pr
meant no one else found it. :)
 1.97.2.1  19-Mar-2005  tron Pull up revision 1.98 (requested by atatat in ticket #11):
Use regexes instead of static lists of annoying numbers to recognize
sysctl nodes that have "helpers". This is more concise, imho more
easy to understand, and has the added bonus of making it *possible* to
assign helpers to dynamically numbered nodes.
 1.120.2.1  30-Dec-2006  riz Pull up following revision(s) (requested by elad in ticket #298):
sbin/sysctl/sysctl.c: revision 1.122
PR/35304: C J Coleman: Off-by-one nul byte overwrite in mode_bits routine
of sbin/sysctl
 1.122.14.1  18-May-2008  yamt sync with head.
 1.122.12.3  17-Jan-2009  mjf Sync with HEAD.
 1.122.12.2  28-Sep-2008  mjf Sync with HEAD.
 1.122.12.1  02-Jun-2008  mjf Sync with HEAD.
 1.123.2.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.124.2.2  13-Jan-2013  bouyer Pull up following revision(s) (requested by msaitoh in ticket #1832):
sbin/sysctl/sysctl.c: revision 1.149 via patch
Add missing free() in error path.
 1.124.2.1  01-Apr-2009  snj Pull up following revision(s) (requested by christos in ticket #635):
sbin/sysctl/sysctl.8: revision 1.160
sbin/sysctl/sysctl.c: revision 1.129
Don't print an error with sysctl -w name?=value if name does not exist.
Should be pulled up to 5.0
 1.125.2.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.138.2.4  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.138.2.3  16-Jan-2013  yamt sync with (a bit old) head
 1.138.2.2  30-Oct-2012  yamt sync with head
 1.138.2.1  17-Apr-2012  yamt sync with head
 1.140.2.1  25-Dec-2012  snj Pull up following revision(s) (requested by msaitoh in ticket #757):
sbin/sysctl/sysctl.c: revision 1.149
Add missing free() in error path.
 1.143.2.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.143.2.1  25-Feb-2013  tls resync with head
 1.151.2.1  10-Aug-2014  tls Rebase.
 1.157.2.2  26-Apr-2017  pgoyette Sync with HEAD
 1.157.2.1  06-Aug-2016  pgoyette Sync with HEAD
 1.158.2.1  21-Apr-2017  bouyer Sync with HEAD
 1.160.4.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.160.4.1  10-Jun-2019  christos Sync with HEAD
 1.160.2.1  26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.161.2.1  19-Aug-2019  martin Pull up following revision(s) (requested by kamil in ticket #95):

sbin/sysctl/prog_ops.h: revision 1.3
sbin/sysctl/sysctl_rumpops.c: revision 1.2
sbin/sysctl/sysctl_hostops.c: revision 1.2
sbin/sysctl/Makefile: revision 1.22
sbin/sysctl/sysctl.c: revision 1.162

sysctl: Add indirection of symbols to remove clash with sanitizers

Add indirection and symbol renaming under MKSANITIZER for the linked in
version of sysctlbyname and sysctlgetmibinfo.

RSS XML Feed