Home | History | Annotate | Download | only in kern
History log of /src/sys/kern/kern_sysctl.c
RevisionDateAuthorComments
 1.271  08-Sep-2024  rillig fix a/an grammar in obvious cases
 1.270  09-Sep-2023  christos Move the initialization of the random hash for addresses earlier so that
it does not happen under a spin lock context (when it is first used).
 1.269  09-Apr-2023  riastradh kern: KASSERT(A && B) -> KASSERT(A); KASSERT(B)
 1.268  17-Feb-2023  skrll Fix SYSCTL_DEBUG_CREATE for non-x86 by using copyin
 1.267  17-Feb-2023  skrll Trailing whitespace
 1.266  27-Aug-2020  riastradh branches: 1.266.20;
Sort includes, nix trailing whitespace, fix comment.
 1.265  27-Aug-2020  riastradh Move address hashing from init_main.c to kern_sysctl.c.

This way rump gets it automatically. Make sure blake2s is in
librumpkern.so, not just in librumpkern_crypto.so, for this to work.
 1.264  03-Jul-2019  maxv Invert two conditions, to fix uninitialized memory access. If the node is
an immediate, then the 64 bits of nnode.sysctl_data may not all be
initialized, since this is an union.

Obviously, this is harmless; but still a bug, so fix it.
 1.263  28-Jan-2019  christos print the names of the sysctl nodes in the KASSERT.
 1.262  14-Oct-2018  jdolecek remove M_CANFAIL flag for malloc(9) - it was completely ignored, so had
actually no effect
 1.261  27-Jan-2018  christos branches: 1.261.2; 1.261.4;
remove useless KASSERT.
 1.260  26-Jan-2018  pgoyette Bounds checking - CID/1428650
 1.259  25-Apr-2017  pgoyette Add a check to ensure that a new sysctl node was attached in the tree
at the place we expected it to be attached!

As mentioned several times (on tech-kern@ mailing list) over the past
18 months or so, I've seen a few instances where this will trigger,
although I've been unable to reproduce them. Hopefully some wider
exposure will reveal the under-lying cause of this rare phenomenon.

Commit was proposed on tech-kern list, and no objections raised.
 1.258  23-Oct-2015  pgoyette branches: 1.258.2;
Fix typx in comment
 1.257  24-Aug-2015  pooka to garnish, dust with _KERNEL_OPT
 1.256  14-Apr-2015  riastradh Need only <sys/rndsource.h>, not <sys/rnd.h>.

Made this change yesterday, failed to commit it -- sorry!
 1.255  14-Apr-2015  nat Include sys/rndsource.h for rnd_add_data.
 1.254  02-Oct-2014  justin branches: 1.254.2;
Work around pedantic compiler
 1.253  10-Aug-2014  tls Merge tls-earlyentropy branch into HEAD.
 1.252  09-Aug-2014  gson Remove the code to allow CTLTYPE_INT and CTLTYPE_QUAD to be read and
written as either 4 or 8 byte values regardless of the type, in
accordance with "Core statement on sysctl 32-bit/64-bit changes",
http://mail-index.netbsd.org/tech-kern/2014/03/26/msg016779.html.
 1.251  12-Jun-2014  joerg Rename old/new to match syscalls.master.
 1.250  16-May-2014  martin Get rid of all sysc_init_field uses - initialize fields directly in C99
notation.
 1.249  27-Mar-2014  christos branches: 1.249.2;
explain how a printf might happen (since it has bitten more than one person)
 1.248  01-Mar-2014  dsl When converting out of range 64bit sysctl values to 'int' (because of
an 'int' sized read) don't assume that sizeof (int) is 4.
 1.247  27-Feb-2014  dsl Allow CTLTYPE_INT and CTLTYPE_QUAD to be read and written as either 4 or 8
byte values regardless of the type.
64bit writes to 32bit variables must be valid (signed) values.
32bit reads of large values return -1.
Amongst other things this should fix libm's code that reads machdep.sse
as a 32bit int, but I'd changed it to 64bit (to common up some code).
 1.246  25-Feb-2014  pooka Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
 1.245  09-Feb-2014  maxv Reorder code to avoid using an uninitialized variable: if
sysctl_copyin fails, 'tmp' is not initialized. This bug is
harmless since only the return value will be different;
it does not expose kernel memory unless diagnostic is enabled.

ok agc@ martin@
 1.244  17-Jan-2014  pooka Put cprng sysctls into subr_cprng.c. Also, make sysctl_prng static
in subr_cprng and get rid of SYSCTL_PRIVATE namespace leak macro.

Fixes ping(8) when run against a standalone rump kernel due to appearance
of the kern.urandom sysctl node (in case someone was wondering ...)
 1.243  27-Apr-2013  christos branches: 1.243.4;
fix warning
 1.242  27-Apr-2013  christos turn off debugging
 1.241  27-Apr-2013  christos Add debugging info.
 1.240  09-Feb-2013  christos CID/980000: missing va_end()
 1.239  02-Feb-2013  matt Make the inclusion of <sys/cprng.h> a private matter for sysctl. No reason
to expose the rest of the kernel to it.
 1.238  29-Jan-2013  para fix the sysctl_setup_func typedef
 1.237  29-Jan-2013  christos remove useless cast (Richard Hansen)
 1.236  06-Jun-2012  matt branches: 1.236.2;
Make sure va_end is used even when errors are encountered.
 1.235  02-Jun-2012  dsl Add some pre-processor magic to verify that the type of the data item
passed to sysctl_createv() actually matches the declared type for
the item itself.
In the places where the caller specifies a function and a structure
address (typically the 'softc') an explicit (void *) cast is now needed.
Fixes bugs in sys/dev/acpi/asus_acpi.c sys/dev/bluetooth/bcsp.c
sys/kern/vfs_bio.c sys/miscfs/syncfs/sync_subr.c and setting
AcpiGbl_EnableAmlDebugObject.
(mostly passing the address of a uint64_t when typed as CTLTYPE_INT).
I've test built quite a few kernels, but there may be some unfixed MD
fallout. Most likely passing &char[] to char *.
Also add CTLFLAG_UNSIGNED for unsiged decimals - not set yet.
 1.234  21-Mar-2012  martin Fix query of IMMEDIATE bool values (copy & pasto).
 1.233  19-Nov-2011  tls branches: 1.233.2; 1.233.4;
First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>. This change includes
the following:

An initial cleanup and minor reorganization of the entropy pool
code in sys/dev/rnd.c and sys/dev/rndpool.c. Several bugs are
fixed. Some effort is made to accumulate entropy more quickly at
boot time.

A generic interface, "rndsink", is added, for stream generators to
request that they be re-keyed with good quality entropy from the pool
as soon as it is available.

The arc4random()/arc4randbytes() implementation in libkern is
adjusted to use the rndsink interface for rekeying, which helps
address the problem of low-quality keys at boot time.

An implementation of the FIPS 140-2 statistical tests for random
number generator quality is provided (libkern/rngtest.c). This
is based on Greg Rose's implementation from Qualcomm.

A new random stream generator, nist_ctr_drbg, is provided. It is
based on an implementation of the NIST SP800-90 CTR_DRBG by
Henric Jungheim. This generator users AES in a modified counter
mode to generate a backtracking-resistant random stream.

An abstraction layer, "cprng", is provided for in-kernel consumers
of randomness. The arc4random/arc4randbytes API is deprecated for
in-kernel use. It is replaced by "cprng_strong". The current
cprng_fast implementation wraps the existing arc4random
implementation. The current cprng_strong implementation wraps the
new CTR_DRBG implementation. Both interfaces are rekeyed from
the entropy pool automatically at intervals justifiable from best
current cryptographic practice.

In some quick tests, cprng_fast() is about the same speed as
the old arc4randbytes(), and cprng_strong() is about 20% faster
than rnd_extract_data(). Performance is expected to improve.

The AES code in src/crypto/rijndael is no longer an optional
kernel component, as it is required by cprng_strong, which is
not an optional kernel component.

The entropy pool output is subjected to the rngtest tests at
startup time; if it fails, the system will reboot. There is
approximately a 3/10000 chance of a false positive from these
tests. Entropy pool _input_ from hardware random numbers is
subjected to the rngtest tests at attach time, as well as the
FIPS continuous-output test, to detect bad or stuck hardware
RNGs; if any are detected, they are detached, but the system
continues to run.

A problem with rndctl(8) is fixed -- datastructures with
pointers in arrays are no longer passed to userspace (this
was not a security problem, but rather a major issue for
compat32). A new kernel will require a new rndctl.

The sysctl kern.arandom() and kern.urandom() nodes are hooked
up to the new generators, but the /dev/*random pseudodevices
are not, yet.

Manual pages for the new kernel interfaces are forthcoming.
 1.232  05-Oct-2011  apb branches: 1.232.2;
s/null terminate/NUL terminate/ in a comment.
From PR 45422 by Greg Woods.
 1.231  17-Jul-2011  joerg Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.230  28-Jan-2011  pooka Move sysctl routines from init_sysctl.c to kern_descrip.c (for
descriptors) and kern_proc.c (for processes). This makes them
usable in a rump kernel, in case somebody was wondering.
 1.229  11-Apr-2010  mrg branches: 1.229.2; 1.229.4;
reject attempts to write CTLTYPE_BOOL nodes with a value other than 0 or 1.
 1.228  13-Jan-2010  pooka branches: 1.228.2; 1.228.4;
Minimize unnecessary differences in rump.
 1.227  24-Dec-2009  elad When reporting open files using sysctl, don't use 'filehead' to fetch files,
as we don't have a process context to authorize on. Instead, traverse the
file descriptor table of each process -- as we already do in one case.

Introduce a "marker" we can use to mark files we've seen in an iteration, as
the same file can be referenced more than once.

Hopefully this availability of filtering by process also makes life easier
for those who are interested in implementing process "containers" etc.
 1.226  16-Sep-2009  pooka Replace a large number of link set based sysctl node creations with
calls from subsystem constructors. Benefits both future kernel
modules and rump.

no change to sysctl nodes on i386/MONOLITHIC & build tested i386/ALL
 1.225  24-Aug-2009  dyoung In sysctl_create(), the first character of sysctl_name is
sysctl_name[0], so write that instead of sysctl_name[sz] (where sz
just happened to be set to 0 in the previous line).

Also in sysctl_create(), give the length of the sysctl_name its
own variable, nsz, and reserve sz for expressing the size of the
node's value.

No functional change intended.
 1.224  21-Aug-2009  dyoung In sysctl_realloc(), don't make 'i' act as both an child-array
iterator and the length of the old child array, but introduce a
new variable, 'olen', for the latter purpose.

In sysctl_alloc(), name a constant.

Introduce sysctl_log_print(), a handy debug routine.

No functional changes intended.
 1.223  21-Aug-2009  dyoung Make sure that a sysctlnode's child nodes, even nodes that are not
yet in service, have a correct pointer to their parent, sysctl_parent.
This fixes a bug where sysctl_teardown(9) could not clean up a
network interface's sysctl(9) trees when I detached it, because
the wrong log had been recorded.
 1.222  15-Apr-2009  elad Remove a few KAUTH_GENERIC_ISSUSER in favor of more descriptive
alternatives.

Discussed on tech-kern:

http://mail-index.netbsd.org/tech-kern/2009/04/11/msg004798.html

Input from ad@, christos@, dyoung@, tsutsui@.

Okay ad@.
 1.221  29-Dec-2008  pooka branches: 1.221.2;
Librate sysctl_setup_func typedef from the clutches of _MODULE and
stuff it in kern_sysctl.c where its only sensible use is.
 1.220  19-Dec-2008  pgoyette When checking for "set-up is complete", look for the CTLFLAGS_PERMANENT
in the root of the tree being modified, rather than in the system default
tree. This permits module compat_netbsd32 to initialize its shadow tree
at load time.

Discussed on tech-kern, with no objections.

Addresses my PR kern/40167
 1.219  12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.218  23-Oct-2008  christos branches: 1.218.2; 1.218.8;
don't expose ksyms_lock
 1.217  20-Oct-2008  ad PR kern/38814 ksyms needs locking

- Make ksyms MT safe.
- Fix deadlock from an operation like "modload foo.lkm < /dev/ksyms".
- Fix uninitialized structure members.
- Reduce memory footprint for loaded modules.
- Export ksyms structures for kernel grovellers like savecore.
- Some KNF.
 1.216  28-Apr-2008  martin branches: 1.216.2; 1.216.6;
Remove clause 3 and 4 from TNF licenses
 1.215  29-Feb-2008  matt branches: 1.215.2; 1.215.4;
Add support for CTLTYPE_BOOL
 1.214  12-Jan-2008  ad branches: 1.214.2; 1.214.6;
sysctl_free: don't have the caller acquire sysctl_treelock, do it here.
 1.213  07-Jan-2008  ad Patch up sysctl locking:

- Lock processes, credentials, filehead etc correctly.
- Acquire a read hold on sysctl_treelock if only doing a query.
- Don't wire down the output buffer. It doesn't work correctly and the code
regularly does long term sleeps with it held - it's not worth it.
- Don't hold locks other than sysctl_lock while doing copyout().
- Drop sysctl_lock while doing copyout / allocating memory in a few places.
- Don't take kernel_lock for sysctl.
- Fix a number of bugs spotted along the way
 1.212  02-Jan-2008  ad Merge vmlocking2 to head.
 1.211  20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.210  15-Aug-2007  ad branches: 1.210.2; 1.210.8; 1.210.10; 1.210.14;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.
 1.209  04-Mar-2007  christos branches: 1.209.2; 1.209.10; 1.209.14;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.208  09-Feb-2007  ad branches: 1.208.2;
Merge newlock2 to head.
 1.207  04-Jan-2007  elad Consistent usage of KAUTH_GENERIC_ISSUSER.
 1.206  01-Nov-2006  yamt remove some __unused from function parameters.
 1.205  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.204  05-Oct-2006  chs add support for O_DIRECT (I/O directly to application memory,
bypassing any kernel caching for file data).
 1.203  23-Sep-2006  manu Add a -t+S flag to ktrace for tracing activity related to sysctl. MIB
names will be displayed, with data readen and written as well.
 1.202  08-Sep-2006  elad branches: 1.202.2;
First take at security model abstraction.

- Add a few scopes to the kernel: system, network, and machdep.

- Add a few more actions/sub-actions (requests), and start using them as
opposed to the KAUTH_GENERIC_ISSUSER place-holders.

- Introduce a basic set of listeners that implement our "traditional"
security model, called "bsd44". This is the default (and only) model we
have at the moment.

- Update all relevant documentation.

- Add some code and docs to help folks who want to actually use this stuff:

* There's a sample overlay model, sitting on-top of "bsd44", for
fast experimenting with tweaking just a subset of an existing model.

This is pretty cool because it's *really* straightforward to do stuff
you had to use ugly hacks for until now...

* And of course, documentation describing how to do the above for quick
reference, including code samples.

All of these changes were tested for regressions using a Python-based
testsuite that will be (I hope) available soon via pkgsrc. Information
about the tests, and how to write new ones, can be found on:

http://kauth.linbsd.org/kauthwiki

NOTE FOR DEVELOPERS: *PLEASE* don't add any code that does any of the
following:

- Uses a KAUTH_GENERIC_ISSUSER kauth(9) request,
- Checks 'securelevel' directly,
- Checks a uid/gid directly.

(or if you feel you have to, contact me first)

This is still work in progress; It's far from being done, but now it'll
be a lot easier.

Relevant mailing list threads:

http://mail-index.netbsd.org/tech-security/2006/01/25/0011.html
http://mail-index.netbsd.org/tech-security/2006/03/24/0001.html
http://mail-index.netbsd.org/tech-security/2006/04/18/0000.html
http://mail-index.netbsd.org/tech-security/2006/05/15/0000.html
http://mail-index.netbsd.org/tech-security/2006/08/01/0000.html
http://mail-index.netbsd.org/tech-security/2006/08/25/0000.html

Many thanks to YAMAMOTO Takashi, Matt Thomas, and Christos Zoulas for help
stablizing kauth(9).

Full credit for the regression tests, making sure these changes didn't break
anything, goes to Matt Fleming and Jaime Fournier.

Happy birthday Randi! :)
 1.201  02-Sep-2006  christos branches: 1.201.2;
delete unreachable code
 1.200  17-Aug-2006  christos Fix all the -D*DEBUG* code that it was rotting away and did not even compile.
Mostly from Arnaud Lacombe, many thanks!
 1.199  30-Jul-2006  elad ugh.. more stuff that's overdue and should not be in 4.0: remove the
sysctl(9) flags CTLFLAG_READONLY[12]. luckily they're not documented
so it's only half regression.

only two knobs used them; proc.curproc.corename (check added in the
existing handler; its CTLFLAG_ANYWRITE, yay) and net.inet.ip.forwsrcrt,
that got its own handler now too.
 1.198  23-Jul-2006  ad Use the LWP cached credentials where sane.
 1.197  12-Jun-2006  christos Don't allocate > 2K on the stack.
 1.196  14-May-2006  elad branches: 1.196.2;
integrate kauth.
 1.195  17-Apr-2006  elad Move securelevel-specific stuff to its own file.
 1.194  02-Apr-2006  dsl Bail out of sysctl_create() if we fail to malloc() own.
free(own) when we bail out if any later malloc() calls fail.
Fixes coverty CID 2310
 1.193  02-Apr-2006  dsl Predicate all the tests against existing children with a single 'if (node)'.
Simplify the test that ensures a CTLFLAG_ANYNUMBER child is an only child.
Will stop the coverty CID 1082 report.
 1.192  17-Mar-2006  chris Move check for rnode being NULL to before it's first use.

Fixes Coverity CID 2434
 1.191  15-Mar-2006  drochner branches: 1.191.2;
Check the "oldlen" argument to sysctl(2) before passing it
to vslock(9). This prevents a local DOS.
(The checks against system and user limits for wired
memory should be centralized in UVM; for now prefer a less
invasive fix which can be pulled pulled up into releases.)
 1.190  05-Mar-2006  yamt branches: 1.190.2; 1.190.4;
sysctl_lookup: use "d" rather than "rnode->sysctl_data" after
"d = rnode->sysctl_data".
 1.189  24-Feb-2006  drochner update comments for const sysctl args
 1.188  27-Nov-2005  yamt branches: 1.188.2; 1.188.4; 1.188.6;
KNF. convert
if () {
}
/*
* some
* comments
*/
else {
}

to
if () {
} else {
/*
* some
* comments
*/
}
 1.187  29-Oct-2005  yamt branches: 1.187.2;
MALLOC/FREE -> malloc/free where appropriate.
 1.186  21-Aug-2005  yamt branches: 1.186.2;
old_sysctl: fix null dereference when oldlenp == NULL.
 1.185  07-Aug-2005  yamt sysctl_create: remove an unused variable.
 1.184  23-Jul-2005  peter Fix an off-by-one in checking the return value of strlcpy(9).

Reviewed by atatat.
 1.183  20-Jun-2005  atatat branches: 1.183.2;
Change the rest of the sysctl subsystem to use const consistently.
The __UNCONST macro is now used only where necessary and the RW macros
are gone. Most of the changes here are consumers of the
sysctl_createv(9) interface that now takes a pair of const pointers
which used not to be.
 1.182  09-Jun-2005  atatat Properly fix the constipated lossage wrt -Wcast-qual and the sysctl
code. I know it's not the prettiest code, but it seems to work rather
well in spite of itself.
 1.181  08-Jun-2005  scw Thou shalt not allocate PAGE_SIZE automatic variables on the kernel stack.
 1.180  29-May-2005  christos - add const.
- remove unnecessary casts.
- add __UNCONST casts and mark them with XXXUNCONST as necessary.
 1.179  26-Feb-2005  perry branches: 1.179.2;
nuke trailing whitespace
 1.178  20-Feb-2005  heas Expose sysctl_root node to kernel sources. It will be used by FreeBSD sysctl
emulation.
 1.177  16-Feb-2005  elric The API for ksyms_getval_from_kernel changed.
 1.176  12-May-2004  cube branches: 1.176.4; 1.176.6;
In sysctl_destroyv, the newly created dnode structure must have its
version set to the correct value to prevent later failure of
sysctl_cvt_in.
 1.175  06-May-2004  atatat Add a printf() to the other case in sysctl_createv() where a node did
not get attached for what should be an extremely unusual case.
 1.174  01-May-2004  matt Define link_sets start/stop as ptype * const [] since they are in a
readonly section.
 1.173  25-Apr-2004  atatat Be consistent about using sysc_init_field()
 1.172  25-Apr-2004  atatat Remove dynamic sysctl node version 0 from the tree. It seemed okay at
first, but quickly showed its shortcomings. The version 1 node we're
now using should be good for a while.
 1.171  06-Apr-2004  atatat First caller to set a description on a node sets it. This allows one
setup function to set the description, even if the node has been
instantiated elsewhere. Or not, depending on the other that the setup
functions are called.
 1.170  01-Apr-2004  atatat Add the standard "is this tree writeable" check to sysctl_describe()
and a comment to sysctl_destroy() about why the check is slightly
different there.
 1.169  27-Mar-2004  atatat branches: 1.169.2;
Fix sysctl_createv() so that rnode and cnode can refer to the same
pointer. Fix sysctl_create() so that nodes cannot be added to an
alias node.
 1.168  25-Mar-2004  atatat Set version in node destroy request
 1.167  25-Mar-2004  atatat Unwind the nested designators for fields within structs within structs
(or unions). This should really be put back once we're all using gcc3
for everything, since that makes it look a *lot* cleaner.
 1.166  24-Mar-2004  atatat Implement sysctl descriptions. Now all that remains is actually to
write them.
 1.165  24-Mar-2004  atatat Framework for sysctl descriptions. Implementation to follow shortly.
 1.164  24-Mar-2004  atatat New node version and layout. This should take care of the netbsd32
emulation problem, formalizes the versioning (should it ever be needed
again), and provides a slot for descriptions.
 1.163  24-Mar-2004  atatat Implement sysctllog and sysctl_teardown(), which unwinds the log.
 1.162  24-Mar-2004  atatat The new sysctl query interface returns the same information as the old
one, but you must pass in an empty node that indicates the version
you're using.
 1.161  24-Mar-2004  atatat Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.
 1.160  24-Mar-2004  atatat That copystr() should be copyinstr(), and fix a couple of places where
aliasing needs to be avoided.
 1.159  08-Mar-2004  atatat Some optimization for sysctl_locate()
 1.158  17-Jan-2004  atatat In sysctl_locate(), use "rnode" like everywhere else, don't call it
"rv".

In sysctl_destroyv(), deal with deleting alias nodes, and pass a token
size_t to sysctl_destroy().

In sysctl_free(), check that "node" has not reached "rnode", not that
"pnode" has.

In sysctl_realloc(), don't bother setting sysctl_clen...the value is
unchanged.
 1.157  29-Dec-2003  atatat Avoid dereferencing l in sysctl_lookup(), because it can be NULL.

Note one point where a possibility of a fault exists.
 1.156  29-Dec-2003  atatat Remove two uses of uvm_kernacc(), which wasn't quite getting the job
done anyway. On a related change, use kcopy() instead of memcpy() for
kernel-to-kernel copying so that the same service warranty can be
given.
 1.155  28-Dec-2003  atatat Sysctl functions called for "generic" nodes should forward "query"
requests (where possible), rather than returning errors.
 1.154  05-Dec-2003  fvdl Resurrect include of opt_insecure.h to get the INSECURE definition.
From Kouichirou Hiratsuka on current-users.
 1.153  04-Dec-2003  atatat Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
 1.152  31-Oct-2003  simonb Remove some assigned-to but otherwise unused variables.
 1.151  21-Oct-2003  thorpej Cache the "adjusted" value of sb_max when sb_max is changed, in order
to avoid doing quad math in sbreserve().

Change suggested by Simon Burge, and code inspired by a similar change
in FreeBSD.
 1.150  19-Oct-2003  simonb Remove unreachable break after return and goto statements.
 1.149  03-Oct-2003  christos If the user passes enough space, output the per cpu states instead of
aggregating them.
 1.148  02-Oct-2003  kleink Need opt_posix.h for P1003_1B_SEMAPHORE.
 1.147  01-Oct-2003  itojun make debug_sysctl() sysctl MIB check more strict. from smak.
attack similar to NetBSD-SA2003-014 can be mounted due to this flaw.
 1.146  28-Sep-2003  dsl Simod has persuaded me to remove the 'sizeof (struct kinfo_drivers)' field.
 1.145  27-Sep-2003  dsl Add kern.root_partition (sysinst needs to know it)
Add kern.drivers - reports driver names and major numbers
Remove some redundant caddr_t casts.
 1.144  03-Sep-2003  ragge Use correct basic types when addresses are given in function calls.
 1.143  24-Aug-2003  atatat Use pfind() in proc_sysctl() to find the target process instead of a
home-grown routine. Remove defcorenamelen, since it's not used
anywhere.
 1.142  24-Aug-2003  itojun make proc.curproc.* check more strict. atatat
 1.141  14-Aug-2003  itojun avoid oldlenp mixup (in-kernel pointer and userland pointer). from atatat
 1.140  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.139  30-Jul-2003  yamt maintain the list of namecaches attached to the vnode.
it makes vnodes freeable.
 1.138  02-Jul-2003  ragge Make somaxkva modifyable via sysctl (and compile-time) instead of
hardcoding its size.
 1.137  29-Jun-2003  fvdl branches: 1.137.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.136  29-Jun-2003  enami Adjust !LKM case for proc * -> lwp * change.
 1.135  28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.134  23-Jun-2003  martin Make sure to include opt_foo.h if a defflag option FOO is used.
 1.133  27-Mar-2003  jdolecek put back nmaxproc check mistakely changed in rev.1.132

checking against nprocs is wrong in any case btw - we do allow
maxproc higher than number of current processes, it would just mean
no new process could be started until number of processes would
be lower than the new limit
 1.132  19-Mar-2003  dsl Alternative pid/proc allocater, removes all searches associated with pid
lookup and allocation, and any dependency on NPROC or MAXUSERS.
NO_PID changed to -1 (and renamed NO_PGID) to remove artificial limit
on PID_MAX.
As discussed on tech-kern.
 1.131  06-Mar-2003  thorpej Based on the feedback on wasabisystems.com!bsd-api-discuss (sure wish
people would read that list in a more timely fashion!), change the new
64-bit memory reporting sysctl nodes to report bytes. This should not
be a problem, since it's only a week old, and no applications use the
new nodes yet.
 1.130  05-Mar-2003  dsl Report correct values for p_uutime_{u}sec, p_ustime_{u}sec and p_uctime_{u}sec
 1.129  01-Mar-2003  enami Cosmetic changes.
 1.128  01-Mar-2003  atatat Add p_svuid and p_svgid to kinfo_proc2. Populate them in the kernel
and in libkvm. Then teach ps how to show them to you.

Also, teach ps how to show the names for all the uids, the rest of the
group numbers, and the "group access list".
 1.127  27-Feb-2003  thorpej Add hw.physpages and hw.userpages, which return the physmem and usermem
values as a u_quad (page count). Necessary for reporting memory on systems
with >=4G. Per disussion on wasabisystems.com!bsd-api-discuss.
 1.126  15-Feb-2003  dsl Fix support for 16 character lognames
(approved by christos)
 1.125  10-Feb-2003  atatat Add a kern.dump_on_panic sysctl variable (and documentation, and a
kernel config option) that controls whether the kernel dumps to the
dump device on panic. Dumps can still be forced via the ``sync''
command from ddb. Defaults to ``on''.
 1.124  02-Feb-2003  kleink Add sysconf(3) knobs for recent additions.
 1.123  18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.122  16-Dec-2002  jdolecek branches: 1.122.2;
add support for optional arch-specific restriction of valid value
for kern.maxproc
 1.121  12-Dec-2002  jdolecek don't allow kern.maxproc bigger than PID_MAX - PID_SKIP; the pid allocation
code in fork1() would enter endless loop if all the allowed pids are taken
by running processes
 1.120  11-Dec-2002  jdolecek Add kern.forkfsleep sysctl - set/get time (in miliseconds) for which
process would be forced to sleep in fork() if it hits either global
or user maxproc limit. Default is zero (no forced sleep).
Maximum is 20 seconds.
 1.119  11-Dec-2002  scw Add two sysctls: kern.labelsector and kern.labeloffset.
These are of use to userland code which previously depended on the
hard-coded values of LABELSECTOR and LABELOFFSET to figure out the
location of the disklabel for a particular platform.

With the introduction of umbrella ports such as evbarm, evbmips, etc,
the location of the disklabel may vary between kernels for the same
MACHINE. This sysctl will allow userland programs to remain independent
of the particular flavour of MACHINE in such cases.
 1.118  24-Nov-2002  scw Quell uninitialised variable warnings.
 1.117  20-Nov-2002  simonb White-space nits.
 1.116  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.115  07-Nov-2002  manu Added two sysctl-able flags: proc.curproc.stopfork and proc.curproc.stopexec
that can be used to block a process after fork(2) or exec(2) calls. The
new process is created in the SSTOP state and is never scheduled for running.

This feature is designed so that it is esay to attach the process using gdb
before it has done anything.

It works also with sproc, kthread_create, clone...
 1.114  02-Nov-2002  perry /*CONTCOND*/ while (0)'ed macros
 1.113  04-Sep-2002  matt Use the queue macros from <sys/queue.h> instead of referring to the queue
members directly. Use *_FOREACH whenever possible.
 1.112  26-Aug-2002  augustss Get rid of sysctl for setting BCM2033 firmware path. It doesn't work
for ports that don't include files.usb, and it's also not done quite
the way it should.
 1.111  25-Aug-2002  thorpej Fix signed/unsigned comparison warnings from GCC 3.3.
 1.110  24-Aug-2002  augustss Add sysctl support for hw.dev.ubtbcmfw (so I can set the firmware
path for my BCM2033).
 1.109  02-Jul-2002  itojun provide KERN_URND, which extracts sizeof(int) random number from the kernel
(similar to /dev/urandom, for use within chroot jail).
 1.108  14-May-2002  matt branches: 1.108.2; 1.108.4;
Eliminate more commons or redundant declarations.
 1.107  13-May-2002  matt debug0, debug1, debug15 are defined elsewhere. XXX there needs to a
better was of doing this.
 1.106  03-Apr-2002  simonb Fix a typo that stopped this compiling in the !LKM case.
Remove the buf2 variable from sysctl_sysvipc(), which was only ever
assigned to but not used.
 1.105  02-Apr-2002  jdolecek make emul_sysctl() work with emulations loaded via LKM, properly bound check
name[0]
 1.104  20-Mar-2002  christos emulation specific sysctls.
 1.103  14-Feb-2002  chs branches: 1.103.4;
allow writing to write-only mappings. fixes PR 3493.
 1.102  11-Feb-2002  jdolecek Switch default for pipes to the faster John S. Dyson's implementation.
Old, socketpair-based ones are available with option PIPE_SOCKETPAIR.
 1.101  31-Jan-2002  kleink Add {POSIX_MONOTONIC_CLOCK} variables.
 1.100  28-Jan-2002  simonb Add sysctls to read tk_{nin,nout,cancc,rawcc} (under a kern.tkstat node).
"extern" those variables in <sys/dkstat.h>, and add declarations for them
in sys/tty.c
 1.99  27-Jan-2002  lukem - kern.maxvnodes: only call vfs_reinit() and nchreinit() if the value
was successfully changed. previously, successfully viewing the
current value would flush the cache :-/
- similarly, don't change hostid and sb_max unless the value was
successfully changed
 1.98  27-Jan-2002  simonb Implement the hw.disknames and hw.diskstats sysctl's that have been listed
in <sys/sysctl.h> since day one but never implemented.
 1.97  12-Nov-2001  lukem add RCSIDs
 1.96  08-Nov-2001  bouyer Fix a memory leak when we change pl_corename several times.
 1.95  24-Sep-2001  chs branches: 1.95.2;
resize the namecache hash table also when desiredvnodes changes.
 1.94  15-Sep-2001  chs add a new VFS op, vfs_reinit, which is called when desiredvnodes is
adjusted via sysctl. file systems that have hash tables which are
sized based on the value of this variable now resize those hash tables
using the new value. the max number of FFS softdeps is also recalculated.

convert various file systems to use the <sys/queue.h> macros for
their hash tables.
 1.93  27-Jul-2001  thorpej branches: 1.93.2;
Add a sysctl to frob sb_max.
 1.92  14-Jul-2001  matt Add support for kern.maxphys, vm.maxslp, vm.uspace (the later two for ps).
 1.91  09-Jul-2001  simonb branches: 1.91.2;
ANSIfy.
 1.90  21-Jun-2001  jdolecek Move prototype of sysctl_dopipe() from <sys/sysctl.h> to <sys/pipe.h>
and adjust kern/kern_sysctl.c accordingly.
 1.89  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.88  26-Apr-2001  enami Make sysctl_msgbuf() to copy message buffer to userland even if
the write pointer points to the beginning of message buffer.
 1.87  15-Mar-2001  chs eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS 0
KERN_INVALID_ADDRESS EFAULT
KERN_PROTECTION_FAILURE EACCES
KERN_NO_SPACE ENOMEM
KERN_INVALID_ARGUMENT EINVAL
KERN_FAILURE various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE ENOMEM
KERN_NOT_RECEIVER <unused>
KERN_NO_ACCESS <unused>
KERN_PAGES_LOCKED <unused>
 1.86  22-Dec-2000  jdolecek branches: 1.86.2;
split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.
 1.85  20-Nov-2000  simonb Add a sysctl_rdminstruct() function - same as sysctl_rdstruct() but
can return short data if *oldlenp is less than len.
 1.84  19-Nov-2000  sommerfeld If MULTIPROCESSOR, count cpus and use that for hw.ncpu
 1.83  19-Nov-2000  sommerfeld Preliminary MULTIPROCESSOR support:
- for CP_TIME, sum the times across all processors.
- for kinfo_proc2, fill in cpu_id.
 1.82  08-Nov-2000  eeh Add console magic sequence framework.
 1.81  26-Sep-2000  thorpej PHOLD/PRELE around uvm_io() to user address space is unnecessary. There
is nothing in the U-area that we need.
 1.80  23-Sep-2000  bjh21 Conditionalise the declaration of sysctl_pty() so that we don't get a
compiler warning in the NPTY==0 case.
 1.79  11-Sep-2000  thorpej Fix 0 vs. NULL confusion.
 1.78  10-Sep-2000  jdolecek handle KERN_MAXPTYS via new sysctl_pty(), which uses pty_maxptys() provided
by tty_pty.c
 1.77  09-Sep-2000  jdolecek allocate pty kernel structures on demand at run-time - this allows
to support arbitrary number of ptys without need of kernel recompile
(the extra device special files in /dev/ still need to be created, of course)

upper limit of supported ptys is controlled via new sysctl variable
kern.maxptys (KERN_MAXPTYS), which is raise-only and defaults to 512.
 1.76  08-Aug-2000  thorpej In fill_kproc2(), testing p->p_stats != NULL doesn't do much good,
instead test for (p->p_flag & I_INMEM), and don't access the U-area
(via p->p_stats) if that bit is clear. Fixes the hangs people have
seen when the system is paging and the user runs top/ps/w.
 1.75  14-Jul-2000  thorpej - Fix the likely cause of the "ps(1) hangs machine" problem. Always
vslock the user pages for the data being copied out to userspace,
so that we won't sleep while holding a lock in case we need to
fault the pages in.
- Sprinkle some const and ANSI'ify some things while here.
 1.74  13-Jul-2000  simonb Add a KERN_CONSDEV sysctl that returns cn_tab->cn_dev (if cn_tab is not
NULL).
 1.73  16-Jun-2000  simonb branches: 1.73.2;
Add #ifdef checks for SYSVMSG, SYSVSEM and SYSVSHM in more places to catch
when some but not all of the SysV IPC facilities are configured.
Problem noticed by Phil Nelson.
 1.72  16-Jun-2000  simonb Add a KERN_MSGBUF sysctl to return the message buffer.
 1.71  13-Jun-2000  simonb In the KERN_GETPROC* handler:
* Handle KERN_PROC_SESSION that has been defined in <sys/sysctl.h> from
day one.
* Add handlers for KERN_PROC_GID and KERN_PROC_RGID.
* If "op" doesn't valid, return EINVAL.
 1.70  03-Jun-2000  thorpej Move schedticks and cp_time into schedstate_percpu. Also, allow
non-primary CPUs to call hardclock(), but make them bail about
before updating global timekeeping state (that's the job of the
primary CPU).
 1.69  02-Jun-2000  simonb Add new sysctl node "KERN_SYSVIPC_INFO" with "KERN_SYSVIPC_MSG_INFO",
"KERN_SYSVIPC_SEM_INFO" and "KERN_SYSVIPC_SHM_INFO" to return the
info and data structures for the relevent SysV IPC types. The return
structures use fixed-size types and should be compat32 safe. All
user-visible changes are protected with
#if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)

Make all variable declarations extern in msg.h, sem.h and shm.h and
add relevent variable declarations to sysv_*.c and remove unneeded
header files from those .c files.

Make compat14 SysV IPC conversion functions and sysctl_file() static.

Change the data pointer to "void *" in sysctl_clockrate(),
sysctl_ntptime(), sysctl_file() and sysctl_doeproc().
 1.68  01-Jun-2000  pk Fix lossage when transferring a pointer value into an off_t var.
 1.67  01-Jun-2000  simonb Plug a slow kernel memory leak - a page was lost for each system or
zombie process queried with the KERN_PROC_ARGS sysctl. Fixed by moving
a malloc call after all possible early return conditions.
 1.66  31-May-2000  thorpej Track which process a CPU is running/has last run on by adding a
p_cpu member to struct proc. Use this in certain places when
accessing scheduler state, etc. For the single-processor case,
just initialize p_cpu in fork1() to avoid having to set it in the
low-level context switch code on platforms which will never have
multiprocessing.

While I'm here, comment a few places where there are known issues
for the SMP implementation.
 1.65  27-May-2000  thorpej branches: 1.65.2;
sleep() -> tsleep()
 1.64  27-May-2000  simonb Set *sizep correctly if returning the number of elements. Pointed out
by Anders Magnusson.

Honor elem_count in the KERN_PROC2 case, as well as overall buffer
space. The only user-land code to use this set the elem_count to
"buffer_space / elem_size", so we've had no incorrect behaviour to date.
 1.63  26-May-2000  thorpej Adjust kinfo_proc2's p_schedflags assignment to match new reality.
 1.62  26-May-2000  simonb Add some new sysctls to help abolish the dreaded "proc size mismatch"
errors from ps(1) and some other kernel grovellers, and return some
data that has previously only been accessable with /dev/kmem read
access. The sysctls are:

+ KERN_PROC2 - return an array of fixed sized "struct kinfo_proc2"
structures that contain most of the useful user-level data in
"struct proc" and "struct user". The sysctl also takes the size of
each element, so that if "struct kinfo_proc2" grows over time old
binaries will still be able to request a fixed size amount of data.
+ KERN_PROC_ARGS - return the argv or envv for a particular process id.
envv will only be returned if the process has the same user id as the
requestor or if the requestor is root.
+ KERN_FSCALE - return the current kernel fixpt scale factor.
+ KERN_CCPU - return the scheduler exponential decay value.
+ KERN_CP_TIME - return cpu time state counters.

With input and suggestions from many people on tech-kern.
 1.61  15-Apr-2000  simonb For the KERN_PROC sysctl, when using KERN_PROC_TTY allow
KERN_PROC_TTY_NODEV to select processes with no controlling
tty and KERN_PROC_TTY_REVOKE to select processes with a
revoked controlling tty.
 1.60  30-Mar-2000  augustss Get rid of register declarations.
 1.59  28-Mar-2000  simonb Centralise the declarations of cpu_model, machine, machine_arch,
osrelease, and ostype and remove "extern char foo[];" (for hostname
and domainname too).

Also delete redunctant decl of boottime in kern_info_43.c.
 1.58  27-Feb-2000  itojun add hw.alignbytes sysctl mib. this gives you the value of ALIGNBYTES
at the kernel compilation time (ALIGNBYTES that the kernel uses).
 1.57  06-Feb-2000  fair Add kernel logging of processes which exit on signals which can
cause a core to drop, and whether the core dropped, or, if it did
not, why not (i.e. error number). Logs process ID, name, signal that
hit it, and whether the core dump was successful.

logging only happens if kern_logsigexit is non-zero, and it can be
changed by the new sysctl(3) value KERN_LOGSIGEXIT. The name of this
sysctl and its function are taken from FreeBSD, at the suggestion
of Greg Woods in PR 6224. Default behavior is zero for a normal
kernel, and one for a kernel compiled with DIAGNOSTIC.
 1.56  16-Jan-2000  assar (sysctl_doeproc): make sure we release the proclist_lock even if
copyout fails
 1.55  17-Nov-1999  is - strings handled by the common functions sysctl_string() and sysctl_rdstring()
are handled as arrays; that is, a truncated old value is returned, alongside
with ENOMEM, if the buffer is too small.

- in all int, quad, and single struct cases, and all specials handled inside
this file, oldlenp semantics are now as documented in the manual page, that
is, a NULL oldp, but non-NULL oldlenp returns the needed size

[I had to change the oldlenp handling, so I thought I should make it as
advertized. Formerly, the subroutines would not know when a NULL oldlenp
was passed, do the work anyway, and the value would be thrown away.]

This is needed as a first step to make gethostname() and getdomainname()
conform to its own manual page and SUSV2. (See pr 7836 by Simon Burge)
 1.54  12-Nov-1999  is Return the data length even for non-readonly strings, as advertized.
 1.53  03-Nov-1999  jdolecek proc_sysctl(): initialize ptmp to NULL - theoretically, ptmp might
be used uninitialized when name[0] != PROC_CURPROC and
proclists[0]->pd_list == NULL; actually, this can never happen
(proclists[0] == &allproc), but the compiler can not know this, so it
complains
 1.52  28-Sep-1999  bouyer branches: 1.52.2; 1.52.4; 1.52.6;
Remplace kern.shortcorename sysctl with a more flexible sheme,
core filename format, which allow to change the name of the core dump,
and to relocate it in a directory. Credits to Bill Sommerfeld for giving me
the idea :)
The default core filename format can be changed by options DEFCORENAME and/or
kern.defcorename
Create a new sysctl tree, proc, which holds per-process values (for now
the corename format, and resources limits). Process is designed by its pid
at the second level name. These values are inherited on fork, and the corename
fomat is reset to defcorename on suid/sgid exec.
Create a p_sugid() function, to take appropriate actions on suid/sgid
exec (for now set the P_SUGID flag and reset the per-proc corename).
Adjust dosetrlimit() to allow changing limits of one proc by another, with
credential controls.
 1.51  27-Sep-1999  kleink 1003.1c: add {LOGIN_NAME_MAX}.
 1.50  25-Jul-1999  thorpej Turn the proclist lock into a read/write spinlock. Update proclist locking
calls to reflect this. Also, block statclock rather than softclock during
in the proclist locking functions, to address a problem reported on
current-users by Sean Doran.
 1.49  22-Jul-1999  thorpej Add a read/write lock to the proclists and PID hash table. Use the
write lock when doing PID allocation, and during the process exit path.
Use a read lock every where else, including within schedcpu() (interrupt
context). Note that holding the write lock implies blocking schedcpu()
from running (blocks softclock).

PID allocation is now MP-safe.

Note this actually fixes a bug on single processor systems that was probably
extremely difficult to tickle; it was possible that schedcpu() would run
off a bad pointer if the right clock interrupt happened to come in the
middle of a LIST_INSERT_HEAD() or LIST_REMOVE() to/from allproc.
 1.48  22-Jul-1999  thorpej Rework the process exit path, in preparation for making process exit
and PID allocation MP-safe. A new process state is added: SDEAD. This
state indicates that a process is dead, but not yet a zombie (has not
yet been processed by the process reaper).

SDEAD processes exist on both the zombproc list (via p_list) and deadproc
(via p_hash; the proc has been removed from the pidhash earlier in the exit
path). When the reaper deals with a process, it changes the state to
SZOMB, so that wait4 can process it.

Add a P_ZOMBIE() macro, which treats a proc in SZOMB or SDEAD as a zombie,
and update various parts of the kernel to reflect the new state.
 1.47  24-Jun-1999  kleink Add compile-time and run-time feature test knobs for the 1003.1 Mapped Files,
Process Memory Locking, Range Memory Locking and Memory Protection options.
 1.46  17-Jun-1999  thorpej Make uvm_vslock() return the error code from uvm_fault_wire(). All places
which use uvm_vslock() should now test the return value. If it's not
KERN_SUCCESS, wiring the pages failed, so the operation which is using
uvm_vslock() should error out.

XXX We currently just EFAULT a failed uvm_vslock(). We may want to do
more about translating error codes in the future.
 1.45  26-May-1999  thorpej XXX Pass VM_PROT_NONE to uvm_vslock() as access_type. Why are we even
vslocking here?! copyout() on its own seems to suffice just about everwhere
else, and it's not like the process is going to exit; it's in a system
call!
 1.44  26-Apr-1999  thorpej Add support for the kern.mbuf sysctl node.
 1.43  24-Mar-1999  mrg branches: 1.43.4;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.42  19-Oct-1998  tron branches: 1.42.2;
Defopt SYSVMSG, SYSVSEM and SYSVSHM.
 1.41  08-Sep-1998  thorpej - Use proclists[], rather than checking allproc and zombproc explicitly.
- Add some comments about locking.
 1.40  03-Aug-1998  kleink Add support to query the
* availability of POSIX Synchronized I/O (kern.synchronized_io),
* maximum number of iovec structures to be used in readv(2) etc. (kern.iov_max)
via sysctl().
 1.39  31-Jul-1998  perry fix sizeofs so they comply with the KNF style guide. yes, it is pedantic.
 1.38  04-Jul-1998  jonathan branches: 1.38.2;
defopt DDB.
 1.37  28-Jun-1998  nathanw Implement short corefile name support, controlled by options SHORTCORENAME
and sysctl kern.shortcorename.

Closes PR kern/5191.
 1.36  24-May-1998  kleink Permit checking the availability of the POSIX File Synchronization Option
(a/k/a fsync(2)), System V style message queues, semaphores and shared memory
at runtime by adding a sysctl variable for each.
 1.35  30-Apr-1998  thorpej Pass vslock() and vsunlock() a proc *, rather than implicitly operating
on curproc.
 1.34  01-Mar-1998  fvdl Merge with Lite2 + local changes
 1.33  14-Feb-1998  thorpej Prevent the session ID from disappearing if the session leader exits
(thus causing s_leader to become NULL) by storing the session ID separately
in the session structure. Export the session ID to userspace in the
eproc structure.

Submitted by Tom Proett <proett@nas.nasa.gov>.
 1.32  10-Feb-1998  mrg - add defopt's for UVM, UVMHIST and PMAP_NEW.
- remove unnecessary UVMHIST_DECL's.
 1.31  05-Feb-1998  mrg initial import of the new virtual memory system, UVM, into -current.

UVM was written by chuck cranor <chuck@maria.wustl.edu>, with some
minor portions derived from the old Mach code. i provided some help
getting swap and paging working, and other bug fixes/ideas. chuck
silvers <chuq@chuq.com> also provided some other fixes.

this is the rest of the MI portion changes.

this will be KNF'd shortly. :-)
 1.30  22-Jan-1998  thorpej Generate dependencies on the INSECURE option.
 1.29  21-Oct-1997  sommerfe Fix PR4313: kern.maxvnodes setting was a psychotic placebo
 1.28  19-Sep-1997  leo branches: 1.28.2;
Implement the kernel part of pr-1891. This allows for a more flexible sized
msgbuf. Note that old 'dmesg' and 'syslogd' binaries will continue running,
though old 'dmesg' binaries will output a few bytes of junk at the start of
the buffer, and will miss a few bytes at the end of the buffer.
 1.27  06-Jun-1997  veego branches: 1.27.4;
Add HW_MACHINE_ARCH for the new sysctl hw.machine_arch which contains the
cpu class of a machine.
 1.26  16-May-1997  gwr Eliminate vmspace.vm_pmap and all references to it unless
__VM_PMAP_HACK is defined (for temporary compatibility).
The __VM_PMAP_HACK code should be removed after all the
ports that define it have removed all vm_pmap references.
 1.25  21-Mar-1997  mikel kern.osrevision now returns value of NetBSD symbol (from <sys/param.h>),
not BSD symbol. fixes PR kern/2016.
 1.24  19-Mar-1997  mycroft fill_eproc(): Fill in e_login. From PR 3351, by Geoff Wing.
 1.23  31-Jan-1997  thorpej Add a sysctl node "kern.root_device", which contains the external
name of the device that root was mounted on (e.g. "sd0").
 1.22  30-Jan-1997  tls remove ability to mangle namei cache
 1.21  15-Jan-1997  perry Eliminate obsolete TIMEZONE and DST options.
Eliminate obsolete global kernel variable "struct timezone tz"
Add RTC_OFFSET option
Add global kernel variable rtc_offset, which is initialized by
RTC_OFFSET at kernel compile time.
on i386, x68k, mac68k, pc532 and arm32, RTC_OFFSET indicates how many
minutes west (east) of GMT the hardware RTC runs. Defaults to 0.
Places where tz variable was used to indicate this in the past have
been replaced with rtc_offset.
Add sysctl interface to rtc_offset.
Kill obsolete DST_* macros in sys/time.h
gettimeofday now always returns zeroed timezone if zone is requested.
settimeofday now ignores and logs attempts to set non-existant kernel
timezone.
 1.20  09-Jan-1997  thorpej branches: 1.20.2;
Grok CTL_DDB.
 1.19  14-Nov-1996  thorpej Only call sysctl_ntptime() if NTP is compiled into the kernel.
 1.18  17-Jul-1996  explorer Add compile-time and run-time control over automatic niceing
 1.17  20-May-1996  mrg initialise securelevel to zero to allow it to be patchable. this is _not_ a security issue.
 1.16  12-Apr-1996  thorpej Fix __sysctl() to return the proper value to the caller, to match
documented behavior. sysctl(3) is documented to return 0 on success,
-1 on failure. The previous behavior was to return -1 on failure
and the number of bytes copied back down to user space.
Fixes part of PR #1999, from Kevin M. Lahey <kml@nas.nasa.gov>
 1.15  27-Feb-1996  jonathan Add NTP kernel precision timekeeping from Dave Mill's xntp distribution
and the "kernel.tar.Z" distribution on louie.udel.edu, which is older than
xntp 3.4y or 3.5a, but contains newer kernel source fragments.

This commit adds support for a new kernel configuration option, NTP.
If NTP is selected, then the system clock should be run at "HZ", which
must be defined at compile time to be one value from:
60, 64, 100, 128, 256, 512, 1024.

Powers of 2 are ideal; 60 and 100 are supported but are marginally less
accurate.

If NTP is not configured, there should be no change in behavior relative
to pre-NTP kernels.

These changes have been tested extensively with xntpd 3.4y on a decstation;
almost identical kernel mods work on an i386. No pulse-per-second (PPS)
line discipline support is included, due to unavailability of hardware
to test it.

With this in-kernel PLL support for NetBSD, both xntp 3.4y and xntp
3.5a user-level code need minor changes. xntp's prototype for
syscall() is correct for FreeBSD, but not for NetBSD.
 1.14  09-Feb-1996  christos More proto fixes
 1.13  04-Feb-1996  christos First pass at prototyping
 1.12  07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.11  19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.10  04-Aug-1995  thorpej Add and document a `kern.rawpartition' sysctl.
 1.9  24-Jun-1995  christos Extracted all of the compat_xxx routines, and created a library [libcompat]
for them. There are a few #ifdef COMPAT_XX remaining, but they are not easy
or worth eliminating (yet).
 1.8  26-Mar-1995  cgd add an 'INSECURE' option which makes securelevel default to -1
 1.7  25-Jan-1995  cgd implement sysctl variable kern.maxpartitions
 1.6  30-Oct-1994  cgd be more careful with types, also pull in headers where necessary.
 1.5  20-Oct-1994  cgd update for new syscall args description mechanism
 1.4  16-Sep-1994  deraadt sparc is not special anymore
 1.3  30-Aug-1994  mycroft Convert process, file, and namei lists and hash tables to use queue.h.
 1.2  29-Jun-1994  cgd New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.1  06-May-1994  cgd branches: 1.1.1;
latent support for general sysctl-ish stuff
 1.1.1.2  01-Mar-1998  fvdl Import 4.4BSD-Lite2
 1.1.1.1  01-Mar-1998  fvdl Import 4.4BSD-Lite for reference
 1.20.2.2  18-Jan-1997  thorpej Update from trunk.
 1.20.2.1  14-Jan-1997  thorpej Snapshot of work-in-progress, committed to private branch.

These changes implement machine-independent root device and file system
selection. Notable features:

- All ports behave in a consistent manner regarding root
device selection.
- No more "options GENERIC"; all kernels have the ability
to boot with RB_ASKNAME to select root device and file system
type.
- Root file system type can be wildcarded; a machine-independent
function will try all possible file systems for the selected
root device until one succeeds.
- If the root file system fails to mount, the operator will
be given the chance to select a new root device and file
system type, rather than having the machine simply panic.
- nfs_mountroot() no longer panics if any part of the NFS
mount process fails; it now returns an error, giving the
operator a chance to recover.
- New, more consistent, config(8) grammar. The constructs:

config netbsd swap generic
config netbsd root on nfs

have been replaced with:

config netbsd root on ? type ?
config netbsd root on ? type nfs

Additionally, the operator may select or wildcard root file
system type in the kernel configuration file:

config netbsd root on cd0a type cd9660

config(8) now requires that a "root" specification be
made. "root" may be wired down or wildcarded. "swap" and
"dump" specifications are optional, and follow previous
semantics.

- config(8) has a new "file-system" keyword, used to configure
file systems into the kernel. Eventually, this will be used
to generate the default vfssw[].

- "options NFSCLIENT" is obsolete, and is replaced by
"file-system NFS". "options NFSSERVER" still exists, since
NFS server support is independent of the NFS file system
client.

- sys/arch/<foo>/<foo>/swapgeneric.c is no longer used, and
will be removed; all information is now generated by config(8).

As of this commit, all ports except arm32 have been updated to use
the new setroot(). Only SPARC, i386, and Alpha ports have been
tested at this time. Port masters should test these changes on their
ports, and report any problems back to me.

More changes are on their way, including RB_ASKNAME support in
nfs_mountroot() (to prompt for server address and path) and, potentially,
the ability to select rarp/bootparam or bootp in nfs_mountroot().
 1.27.4.1  22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.28.2.1  22-Oct-1997  mellon pull up from main trunk
 1.38.2.1  08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.42.2.1  09-Nov-1998  chs initial snapshot. lots left to do.
 1.43.4.3  02-Aug-1999  thorpej Update from trunk.
 1.43.4.2  01-Jul-1999  thorpej Sync w/ -current.
 1.43.4.1  21-Jun-1999  thorpej Sync w/ -current.
 1.52.6.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.52.4.1  15-Nov-1999  fvdl Sync with -current
 1.52.2.4  27-Mar-2001  bouyer Sync with HEAD.
 1.52.2.3  05-Jan-2001  bouyer Sync with HEAD
 1.52.2.2  22-Nov-2000  bouyer Sync with HEAD.
 1.52.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.65.2.1  22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.73.2.8  08-Oct-2003  msaitoh Pull up revision 1.147 via patch (requested by itojun in ticket #88):
make debug_sysctl() sysctl MIB check more strict. from smak.
attack similar to NetBSD-SA2003-014 can be mounted due to this flaw.
 1.73.2.7  27-Aug-2003  msaitoh Pull up revision 1.141 (requested by itojun in ticket #76):
avoid oldlenp mixup (in-kernel pointer and userland pointer). from atatat
 1.73.2.6  27-Aug-2003  msaitoh Pullup rev. 1.142 via patch (requested by itojun in ticket #74):
make proc.curproc.* check more strict.
 1.73.2.5  27-Aug-2003  msaitoh Pull up rev. 1.143 via patch (requested by atatat in ticket #75):
Use pfind() in proc_sysctl() to find the target process instead of a
home-grown routine. Remove defcorenamelen, since it's not used
anywhere.
 1.73.2.4  05-Jan-2002  he Pull up revision 1.96 (requested by bouyer):
Fix a memory leak when pl_corename is changed more than once.
 1.73.2.3  08-Aug-2000  thorpej Pull up rev. 1.76:
In fill_kproc2(), testing p->p_stats != NULL doesn't do much good,
instead test for (p->p_flag & I_INMEM), and don't access the U-area
(via p->p_stats) if that bit is clear. Fixes the hangs people have
seen when the system is paging and the user runs top/ps/w.
 1.73.2.2  22-Jul-2000  simonb Pull up rev 1.74:
Add a KERN_CONSDEV sysctl that returns cn_tab->cn_dev (if cn_tab is not
NULL).
 1.73.2.1  14-Jul-2000  thorpej Update from trunk:
- Fix the likely cause of the "ps(1) hangs machine" problem. Always
vslock the user pages for the data being copied out to userspace,
so that we won't sleep while holding a lock in case we need to
fault the pages in.
- Sprinkle some const and ANSI'ify some things while here.
 1.86.2.27  19-Dec-2002  thorpej Sync with HEAD.
 1.86.2.26  11-Dec-2002  thorpej Sync with HEAD.
 1.86.2.25  11-Dec-2002  thorpej Sync with HEAD.
 1.86.2.24  11-Nov-2002  nathanw Catch up to -current
 1.86.2.23  17-Sep-2002  nathanw Catch up to -current.
 1.86.2.22  27-Aug-2002  nathanw Catch up to -current.
 1.86.2.21  01-Aug-2002  nathanw Catch up to -current.
 1.86.2.20  12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.86.2.19  20-Jun-2002  nathanw Catch up to -current.
 1.86.2.18  29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.86.2.17  24-Apr-2002  nathanw Pasto: use =, not |=, when setting kl->l_flag.
 1.86.2.16  24-Apr-2002  nathanw Fill in p_realstat and l_laddr.
 1.86.2.15  23-Apr-2002  nathanw Fill in the new fields in struct kinfo_proc2.
Add KERN_LWP handling.
 1.86.2.14  17-Apr-2002  nathanw Catch up to -current.
 1.86.2.13  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.86.2.12  28-Feb-2002  nathanw Catch up to -current.
 1.86.2.11  29-Nov-2001  nathanw Make proc_representative_lwp() non-static and move it to kern_lwp.c.
 1.86.2.10  14-Nov-2001  nathanw Catch up to -current.
 1.86.2.9  26-Sep-2001  nathanw Catch up to -current.
Again.
 1.86.2.8  21-Sep-2001  nathanw Catch up to -current.
 1.86.2.7  10-Sep-2001  nathanw Make the information from the representative LWP's l_stat and l_flag
appear in ki->p_stat and ki->p_flag, so that top and ps display more
useful information.
 1.86.2.6  24-Aug-2001  nathanw Catch up with -current.
 1.86.2.5  21-Jun-2001  nathanw Catch up to -current.
 1.86.2.4  20-Jun-2001  nathanw In proc_representative_lwp(), include LWPs in state LSSUSPENDED, in case
they're the only things left.
 1.86.2.3  09-Apr-2001  nathanw Catch up with -current.
 1.86.2.2  29-Mar-2001  nathanw Don't try to find a representative LWP for a dead or zombie process;
there won't be such a thing.
 1.86.2.1  05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.91.2.7  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.91.2.6  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.91.2.5  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.91.2.4  16-Mar-2002  jdolecek Catch up with -current.
 1.91.2.3  11-Feb-2002  jdolecek Sync w/ -current.
 1.91.2.2  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.91.2.1  03-Aug-2001  lukem update to -current
 1.93.2.3  13-Oct-2001  fvdl Revert the t_dev -> t_devvp change in struct tty. The way that tty
structs are currently used (especially by console ttys) aren't
ready for it, and this will require quite a few changes.
 1.93.2.2  01-Oct-2001  fvdl Catch up with -current.
 1.93.2.1  07-Sep-2001  thorpej Commit my "devvp" changes to the thorpej-devvp branch. This
replaces the use of dev_t in most places with a struct vnode *.

This will form the basic infrastructure for real cloning device
support (besides being architecurally cleaner -- it'll be good
to get away from using numbers to represent objects).
 1.95.2.1  12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.103.4.1  11-Mar-2002  thorpej Convert sysctl_memlock to an adaptive mutex.
 1.108.4.4  02-Oct-2003  tron Pull up revision 1.147 (requested by itojun in ticket #1493):
make debug_sysctl() sysctl MIB check more strict. from smak.
attack similar to NetBSD-SA2003-014 can be mounted due to this flaw.
 1.108.4.3  27-Aug-2003  tron Pull up revision 1.141 (requested by itojun in ticket #1441):
avoid oldlenp mixup (in-kernel pointer and userland pointer). from atatat
 1.108.4.2  26-Aug-2003  tron Pull up revision 1.143 via patch (requested by atatat in ticket #1437):
Use pfind() in proc_sysctl() to find the target process instead of a
home-grown routine. Remove defcorenamelen, since it's not used
anywhere.
 1.108.4.1  24-Aug-2003  tron Pull up revision 1.142 via patch (requested by itojun in ticket #1435):
make proc.curproc.* check more strict. atatat
 1.108.2.2  29-Aug-2002  gehenna catch up with -current.
 1.108.2.1  15-Jul-2002  gehenna catch up with -current.
 1.122.2.1  18-Dec-2002  gmcgarry Merge pcred and ucred, and poolify. TBD: check backward compatibility
and factor-out some higher-level functionality.
 1.137.2.9  11-Dec-2005  christos Sync with head.
 1.137.2.8  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.137.2.7  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.137.2.6  17-Feb-2005  skrll Sync with HEAD.
 1.137.2.5  21-Sep-2004  skrll Fix the sync with head I botched.
 1.137.2.4  18-Sep-2004  skrll Sync with HEAD.
 1.137.2.3  03-Aug-2004  skrll Sync with HEAD
 1.137.2.2  02-Jul-2003  wrstuden Check in lwp-ification changes needed to get the evbarm/IQ80321 kernel
to compile.

only question I have is over the:
l->l_proc->p_stats->p_ru.ru_msgsnd++;
command at line 245 of dev/kttcp.c. Should we be doing per-lwp or
per-proc accounting?
 1.137.2.1  02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.169.2.7  24-Mar-2006  riz Pull up following revision(s) (requested by drochner in ticket #10381):
sys/kern/kern_sysctl.c: revision 1.191
Check the "oldlen" argument to sysctl(2) before passing it
to vslock(9). This prevents a local DOS.
(The checks against system and user limits for wired
memory should be centralized in UVM; for now prefer a less
invasive fix which can be pulled pulled up into releases.)
 1.169.2.6  14-May-2004  jdc branches: 1.169.2.6.2; 1.169.2.6.4;
Pull up revision 1.176 (requested by cube in ticket #319).

In sysctl_destroyv, the newly created dnode structure must have its
version set to the correct value to prevent later failure of
sysctl_cvt_in.
 1.169.2.5  10-May-2004  tron Pull up revision 1.175 (requested by atatat in ticket #273):
Add a printf() to the other case in sysctl_createv() where a node did
not get attached for what should be an extremely unusual case.
 1.169.2.4  28-Apr-2004  jmc Pullup rev 1.173 (requested by atatat in ticket #194)

Be consistent about using sysc_init_field()
 1.169.2.3  28-Apr-2004  jmc Pullup rev 1.172 (requested by atatat in ticket #193)

Remove dynamic sysctl node version 0 from the tree.
 1.169.2.2  07-Apr-2004  jmc Pullup rev 1.171 (requested by atatat in ticket #77)

First caller to set a description on a node sets it. This allows one
setup function to set the description, even if the node has been
instantiated elsewhere. Or not, depending on the other that the setup
functions are called.
 1.169.2.1  01-Apr-2004  jmc Pullup rev 1.170 (requested by atatat in ticket #37)

Add the standard "is this tree writeable" check to sysctl_describe()
and a comment to sysctl_destroy() about why the check is slightly
different there.
 1.169.2.6.4.1  24-Mar-2006  riz Pull up following revision(s) (requested by drochner in ticket #10381):
sys/kern/kern_sysctl.c: revision 1.191
Check the "oldlen" argument to sysctl(2) before passing it
to vslock(9). This prevents a local DOS.
(The checks against system and user limits for wired
memory should be centralized in UVM; for now prefer a less
invasive fix which can be pulled pulled up into releases.)
 1.169.2.6.2.1  24-Mar-2006  riz Pull up following revision(s) (requested by drochner in ticket #10381):
sys/kern/kern_sysctl.c: revision 1.191
Check the "oldlen" argument to sysctl(2) before passing it
to vslock(9). This prevents a local DOS.
(The checks against system and user limits for wired
memory should be centralized in UVM; for now prefer a less
invasive fix which can be pulled pulled up into releases.)
 1.176.6.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.176.4.1  29-Apr-2005  kent sync with -current
 1.179.2.2  24-Mar-2006  riz Pull up following revision(s) (requested by drochner in ticket #1217):
sys/kern/kern_sysctl.c: revision 1.191
Check the "oldlen" argument to sysctl(2) before passing it
to vslock(9). This prevents a local DOS.
(The checks against system and user limits for wired
memory should be centralized in UVM; for now prefer a less
invasive fix which can be pulled pulled up into releases.)
 1.179.2.1  28-Aug-2005  tron branches: 1.179.2.1.2;
Pull up following revision(s) (requested by yamt in ticket #703):
sys/kern/kern_sysctl.c: revision 1.186
old_sysctl: fix null dereference when oldlenp == NULL.
 1.179.2.1.2.1  24-Mar-2006  riz Pull up following revision(s) (requested by drochner in ticket #1217):
sys/kern/kern_sysctl.c: revision 1.191
Check the "oldlen" argument to sysctl(2) before passing it
to vslock(9). This prevents a local DOS.
(The checks against system and user limits for wired
memory should be centralized in UVM; for now prefer a less
invasive fix which can be pulled pulled up into releases.)
 1.183.2.6  17-Mar-2008  yamt sync with head.
 1.183.2.5  21-Jan-2008  yamt sync with head
 1.183.2.4  03-Sep-2007  yamt sync with head.
 1.183.2.3  26-Feb-2007  yamt sync with head.
 1.183.2.2  30-Dec-2006  yamt sync with head.
 1.183.2.1  21-Jun-2006  yamt sync with head.
 1.186.2.1  02-Nov-2005  yamt sync with head.
 1.187.2.1  29-Nov-2005  yamt sync with head.
 1.188.6.2  01-Jun-2006  kardel Sync with head.
 1.188.6.1  22-Apr-2006  simonb Sync with head.
 1.188.4.1  09-Sep-2006  rpaulo sync with head
 1.188.2.1  01-Mar-2006  yamt sync with head.
 1.190.4.4  06-May-2006  christos - Move kauth_cred_t declaration to <sys/types.h>
- Cleanup struct ucred; forward declarations that are unused.
- Don't include <sys/kauth.h> in any header, but include it in the c files
that need it.

Approved by core.
 1.190.4.3  19-Apr-2006  elad sync with head.
 1.190.4.2  10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.190.4.1  08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.190.2.8  14-Sep-2006  yamt sync with head.
 1.190.2.7  03-Sep-2006  yamt sync with head.
 1.190.2.6  11-Aug-2006  yamt sync with head
 1.190.2.5  26-Jun-2006  yamt sync with head.
 1.190.2.4  24-May-2006  yamt sync with head.
 1.190.2.3  11-Apr-2006  yamt sync with head
 1.190.2.2  01-Apr-2006  yamt sync with head.
 1.190.2.1  05-Mar-2006  yamt file kern_sysctl.c was added on branch yamt-pdpolicy on 2006-04-01 12:07:39 +0000
 1.191.2.2  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.191.2.1  28-Mar-2006  tron Merge 2006-03-28 NetBSD-current into the "peter-altq" branch.
 1.196.2.1  19-Jun-2006  chap Sync with head.
 1.201.2.4  30-Jan-2007  ad Remove support for SA. Ok core@.
 1.201.2.3  12-Jan-2007  ad Sync with head.
 1.201.2.2  18-Nov-2006  ad Sync with head.
 1.201.2.1  11-Sep-2006  ad - Convert some lockmgr() locks to mutexes and RW locks.
- Acquire proclist_lock and p_crmutex in some obvious places.
 1.202.2.2  10-Dec-2006  yamt sync with head.
 1.202.2.1  22-Oct-2006  yamt sync with head
 1.208.2.1  12-Mar-2007  rmind Sync with HEAD.
 1.209.14.1  16-Aug-2007  jmcneill Sync with HEAD.
 1.209.10.1  03-Sep-2007  skrll Sync with HEAD.
 1.209.2.1  20-Aug-2007  ad Sync with HEAD.
 1.210.14.3  19-Jan-2008  bouyer Sync with HEAD
 1.210.14.2  08-Jan-2008  bouyer Sync with HEAD
 1.210.14.1  02-Jan-2008  bouyer Sync with HEAD
 1.210.10.2  26-Dec-2007  ad - Push kernel_lock back into exit, wait and sysctl system calls, mainly
for visibility.
- Serialize calls to brk() from within the same process.
- Mark more syscalls MPSAFE.
 1.210.10.1  26-Dec-2007  ad Sync with head.
 1.210.8.1  18-Feb-2008  mjf Sync with HEAD.
 1.210.2.2  23-Mar-2008  matt sync with HEAD
 1.210.2.1  09-Jan-2008  matt sync with HEAD
 1.214.6.3  17-Jan-2009  mjf Sync with HEAD.
 1.214.6.2  02-Jun-2008  mjf Sync with HEAD.
 1.214.6.1  03-Apr-2008  mjf Sync with HEAD.
 1.214.2.1  24-Mar-2008  keiichi sync with head.
 1.215.4.5  11-Aug-2010  yamt sync with head.
 1.215.4.4  11-Mar-2010  yamt sync with head
 1.215.4.3  16-Sep-2009  yamt sync with head
 1.215.4.2  04-May-2009  yamt sync with head.
 1.215.4.1  16-May-2008  yamt sync with head.
 1.215.2.1  18-May-2008  yamt sync with head.
 1.216.6.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.216.2.2  14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.216.2.1  10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.218.8.1  04-Jun-2012  matt Each va_start needs a corresponding va_end, even in the error paths...
 1.218.2.2  28-Apr-2009  skrll Sync with HEAD.
 1.218.2.1  19-Jan-2009  skrll Sync with HEAD.
 1.221.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.228.4.2  05-Mar-2011  rmind sync with head
 1.228.4.1  30-May-2010  rmind sync with head
 1.228.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.229.4.1  08-Feb-2011  bouyer Sync with HEAD
 1.229.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.232.2.3  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.232.2.2  30-Oct-2012  yamt sync with head
 1.232.2.1  17-Apr-2012  yamt sync with head
 1.233.4.1  22-Mar-2012  riz Pull up following revision(s) (requested by martin in ticket #135):
sys/kern/kern_sysctl.c: revision 1.234
Fix query of IMMEDIATE bool values (copy & pasto).
 1.233.2.1  05-Apr-2012  mrg sync to latest -current.
 1.236.2.4  03-Dec-2017  jdolecek update from HEAD
 1.236.2.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.236.2.2  23-Jun-2013  tls resync from head
 1.236.2.1  25-Feb-2013  tls resync with head
 1.243.4.1  18-May-2014  rmind sync with head
 1.249.2.2  10-Aug-2014  tls Rebase.
 1.249.2.1  07-Apr-2014  tls Get more entropy into the system early:

1) Add device attach timings from autoconf.
2) Accumulate the output of kernel printf (as well as the times
when it's called) and add this periodically. To avoid issues
with recursion through diagnostic printfs, we use SHA512 to
accumulate the printf output, then mix in its output.
3) Add all sysctl settings -- mixes in the hostname and likely a
bit more.
 1.254.2.4  28-Aug-2017  skrll Sync with HEAD
 1.254.2.3  27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.254.2.2  22-Sep-2015  skrll Sync with HEAD
 1.254.2.1  06-Jun-2015  skrll Sync with HEAD
 1.258.2.1  26-Apr-2017  pgoyette Sync with HEAD
 1.261.4.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.261.4.1  10-Jun-2019  christos Sync with HEAD
 1.261.2.1  20-Oct-2018  pgoyette Sync with head
 1.266.20.1  20-Sep-2024  martin Pull up following revision(s) (requested by rin in ticket #870):

sys/kern/kern_sysctl.c: revision 1.267
sys/kern/kern_sysctl.c: revision 1.268

Trailing whitespace

Fix SYSCTL_DEBUG_CREATE for non-x86 by using copyin

RSS XML Feed