Skip site navigation (1)Skip section navigation (2)

CVS log for src/sys/kern/kern_sysctl.c

[BACK] Up to [FreeBSD] / src / sys / kern

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.218.2.1.2.1: download - view: text, markup, annotated - select for diffs
Fri Nov 11 04:20:22 2011 UTC (2 months, 4 weeks ago) by kensmith
Branches: RELENG_9_0
CVS tags: RELENG_9_0_0_RELEASE
Diff to: previous 1.218.2.1: preferred, colored
Changes since revision 1.218.2.1: +0 -0 lines
SVN rev 227445 on 2011-11-11 04:20:22Z by kensmith

Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
cycle.

Approved by:	re (implicit)

Revision 1.218.2.1: download - view: text, markup, annotated - select for diffs
Fri Sep 23 00:51:37 2011 UTC (4 months, 2 weeks ago) by kensmith
Branches: RELENG_9
CVS tags: RELENG_9_0_BP
Branch point for: RELENG_9_0
Diff to: previous 1.218: preferred, colored
Changes since revision 1.218: +0 -0 lines
SVN rev 225736 on 2011-09-23 00:51:37Z by kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by:	re (implicit)

Revision 1.218: download - view: text, markup, annotated - select for diffs
Fri Sep 16 13:58:51 2011 UTC (4 months, 3 weeks ago) by kmacy
Branches: MAIN
CVS tags: RELENG_9_BP, HEAD
Branch point for: RELENG_9
Diff to: previous 1.217: preferred, colored
Changes since revision 1.217: +1 -1 lines
SVN rev 225617 on 2011-09-16 13:58:51Z by kmacy

In order to maximize the re-usability of kernel code in user space this
patch modifies makesyscalls.sh to prefix all of the non-compatibility
calls (e.g. not linux_, freebsd32_) with sys_ and updates the kernel
entry points and all places in the code that use them. It also
fixes an additional name space collision between the kernel function
psignal and the libc function of the same name by renaming the kernel
psignal kern_psignal(). By introducing this change now we will ease future
MFCs that change syscalls.

Reviewed by:	rwatson
Approved by:	re (bz)

Revision 1.217: download - view: text, markup, annotated - select for diffs
Sun Jul 17 23:05:24 2011 UTC (6 months, 3 weeks ago) by rwatson
Branches: MAIN
Diff to: previous 1.216: preferred, colored
Changes since revision 1.216: +36 -6 lines
SVN rev 224159 on 2011-07-17 23:05:24Z by rwatson

Define two new sysctl node flags: CTLFLAG_CAPRD and CTLFLAG_CAPRW, which
may be jointly referenced via the mask CTLFLAG_CAPRW.  Sysctls with these
flags are available in Capsicum's capability mode; other sysctl nodes are
not.

Flag several useful sysctls as available in capability mode, such as memory
layout sysctls required by the run-time linker and malloc(3).  Also expose
access to randomness and available kernel features.

A few sysctls are enabled to support name->MIB conversion; these may leak
information to capability mode by virtue of providing resolution on names
not flagged for access in capability mode.  This is, generally, not a huge
problem, but might be something to resolve in the future.  Flag these cases
with XXX comments.

Submitted by:	jonathan
Sponsored by:	Google, Inc.

Revision 1.177.2.11: download - view: text, markup, annotated - select for diffs
Wed Jun 1 18:27:13 2011 UTC (8 months, 1 week ago) by mdf
Branches: RELENG_7
Diff to: previous 1.177.2.10: preferred, colored; branchpoint 1.177: preferred, colored; next MAIN 1.178: preferred, colored
Changes since revision 1.177.2.10: +26 -0 lines
SVN rev 222580 on 2011-06-01 18:27:13Z by mdf

Partial MFC of r212370.  np@ requested this functionality so I kept in
the cxgb change, but otherwise MFC'd only the new function
sbuf_new_for_sysctl(9) and none of the changed code.

MFC r217830:

Document sbuf_new_for_sysctl(9).

Partial MFC of r217916:

Explicitly wire the user buffer rather than doing it implicitly in
sbuf_new_for_sysctl(9).  This allows using an sbuf with a SYSCTL_OUT
drain for extremely large amounts of data where the caller knows that
appropriate references are held, and sleeping is not an issue.

Revision 1.201.2.5: download - view: text, markup, annotated - select for diffs
Wed Jun 1 18:26:59 2011 UTC (8 months, 1 week ago) by mdf
Branches: RELENG_8
Diff to: previous 1.201.2.4: preferred, colored; branchpoint 1.201: preferred, colored; next MAIN 1.202: preferred, colored
Changes since revision 1.201.2.4: +26 -0 lines
SVN rev 222579 on 2011-06-01 18:26:59Z by mdf

Partial MFC of r212370.  np@ requested this functionality so I kept in
the cxgb change, but otherwise MFC'd only the new function
sbuf_new_for_sysctl(9) and none of the changed code.

MFC r217830:

Document sbuf_new_for_sysctl(9).

Partial MFC of r217916:

Explicitly wire the user buffer rather than doing it implicitly in
sbuf_new_for_sysctl(9).  This allows using an sbuf with a SYSCTL_OUT
drain for extremely large amounts of data where the caller knows that
appropriate references are held, and sleeping is not an issue.

Revision 1.216: download - view: text, markup, annotated - select for diffs
Fri May 13 05:27:58 2011 UTC (8 months, 4 weeks ago) by mdf
Branches: MAIN
Diff to: previous 1.215: preferred, colored
Changes since revision 1.215: +1 -1 lines
SVN rev 221829 on 2011-05-13 05:27:58Z by mdf

Use a name instead of a magic number for kern_yield(9) when the priority
should not change.  Fetch the td_user_pri under the thread lock.  This
is probably not necessary but a magic number also seems preferable to
knowing the implementation details here.

Requested by:	Jason Behmer < jason DOT behmer AT isilon DOT com >

Revision 1.177.2.10: download - view: text, markup, annotated - select for diffs
Fri Mar 25 22:11:54 2011 UTC (10 months, 2 weeks ago) by mdf
Branches: RELENG_7
Diff to: previous 1.177.2.9: preferred, colored; branchpoint 1.177: preferred, colored
Changes since revision 1.177.2.9: +68 -28 lines
SVN rev 220012 on 2011-03-25 22:11:54Z by mdf

MFC r216060.  This differs from the original commit in that it
preserves the KBI size of struct sysctl_oid.  Also, on stable/8 the
compiler thinks that 'len' in sysctl_sysctl_name2oid() is used
uninitialized.

Do not hold the sysctl lock across a call to the handler.  This fixes a
general LOR issue where the sysctl lock had no good place in the
hierarchy.  One specific instance is #284 on
http://sources.zabbadoz.net/freebsd/lor.html .

Revision 1.201.2.4: download - view: text, markup, annotated - select for diffs
Fri Mar 25 22:11:39 2011 UTC (10 months, 2 weeks ago) by mdf
Branches: RELENG_8
Diff to: previous 1.201.2.3: preferred, colored; branchpoint 1.201: preferred, colored
Changes since revision 1.201.2.3: +68 -28 lines
SVN rev 220011 on 2011-03-25 22:11:39Z by mdf

MFC r216060.  This differs from the original commit in that it
preserves the KBI size of struct sysctl_oid.  Also, on stable/8 the
compiler thinks that 'len' in sysctl_sysctl_name2oid() is used
uninitialized.

Do not hold the sysctl lock across a call to the handler.  This fixes a
general LOR issue where the sysctl lock had no good place in the
hierarchy.  One specific instance is #284 on
http://sources.zabbadoz.net/freebsd/lor.html .

Revision 1.177.2.9: download - view: text, markup, annotated - select for diffs
Fri Mar 25 22:00:43 2011 UTC (10 months, 2 weeks ago) by mdf
Branches: RELENG_7
Diff to: previous 1.177.2.8: preferred, colored; branchpoint 1.177: preferred, colored
Changes since revision 1.177.2.8: +27 -25 lines
SVN rev 220010 on 2011-03-25 22:00:43Z by mdf

MFC r216058 and r216059:

r216058:

Use the SYSCTL_CHILDREN macro in kern_sysctl.c to help de-obfuscate the
code.

r216059:

Slightly modify the logic in sysctl_find_oid to reduce the indentation.
There should be no functional change.

Revision 1.215: download - view: text, markup, annotated - select for diffs
Mon Mar 21 09:40:01 2011 UTC (10 months, 3 weeks ago) by jeff
Branches: MAIN
Diff to: previous 1.214: preferred, colored
Changes since revision 1.214: +26 -4 lines
SVN rev 219819 on 2011-03-21 09:40:01Z by jeff

 - Merge changes to the base system to support OFED.  These include
   a wider arg2 for sysctl, updates to vlan code, IFT_INFINIBAND,
   and other miscellaneous small features.

Revision 1.214: download - view: text, markup, annotated - select for diffs
Tue Feb 8 00:16:36 2011 UTC (12 months ago) by mdf
Branches: MAIN
Diff to: previous 1.213: preferred, colored
Changes since revision 1.213: +1 -1 lines
SVN rev 218424 on 2011-02-08 00:16:36Z by mdf

Based on discussions on the svn-src mailing list, rework r218195:

 - entirely eliminate some calls to uio_yeild() as being unnecessary,
   such as in a sysctl handler.

 - move should_yield() and maybe_yield() to kern_synch.c and move the
   prototypes from sys/uio.h to sys/proc.h

 - add a slightly more generic kern_yield() that can replace the
   functionality of uio_yield().

 - replace source uses of uio_yield() with the functional equivalent,
   or in some cases do not change the thread priority when switching.

 - fix a logic inversion bug in vlrureclaim(), pointed out by bde@.

 - instead of using the per-cpu last switched ticks, use a per thread
   variable for should_yield().  With PREEMPTION, the only reasonable
   use of this is to determine if a lock has been held a long time and
   relinquish it.  Without PREEMPTION, this is essentially the same as
   the per-cpu variable.

Revision 1.213: download - view: text, markup, annotated - select for diffs
Thu Jan 27 00:34:12 2011 UTC (12 months, 1 week ago) by mdf
Branches: MAIN
Diff to: previous 1.212: preferred, colored
Changes since revision 1.212: +2 -4 lines
SVN rev 217916 on 2011-01-27 00:34:12Z by mdf

Explicitly wire the user buffer rather than doing it implicitly in
sbuf_new_for_sysctl(9).  This allows using an sbuf with a SYSCTL_OUT
drain for extremely large amounts of data where the caller knows that
appropriate references are held, and sleeping is not an issue.

Inspired by:	rwatson

Revision 1.212: download - view: text, markup, annotated - select for diffs
Wed Jan 26 22:48:09 2011 UTC (12 months, 1 week ago) by mdf
Branches: MAIN
Diff to: previous 1.211: preferred, colored
Changes since revision 1.211: +3 -5 lines
SVN rev 217915 on 2011-01-26 22:48:09Z by mdf

Remove the CTLFLAG_NOLOCK as it seems to be both unused and
unfunctional.  Wiring the user buffer has only been done explicitly
since r101422.

Mark the kern.disks sysctl as MPSAFE since it is and it seems to have
been mis-using the NOLOCK flag.

Partially break the KPI (but not the KBI) for the sysctl_req 'lock'
field since this member should be private and the "REQ_LOCKED" state
seems meaningless now.

Revision 1.211: download - view: text, markup, annotated - select for diffs
Wed Jan 19 23:00:25 2011 UTC (12 months, 2 weeks ago) by mdf
Branches: MAIN
Diff to: previous 1.210: preferred, colored
Changes since revision 1.210: +6 -3 lines
SVN rev 217616 on 2011-01-19 23:00:25Z by mdf

Introduce signed and unsigned version of CTLTYPE_QUAD, renaming
existing uses.  Rename sysctl_handle_quad() to sysctl_handle_64().

Revision 1.210: download - view: text, markup, annotated - select for diffs
Tue Jan 18 21:14:18 2011 UTC (12 months, 3 weeks ago) by mdf
Branches: MAIN
Diff to: previous 1.209: preferred, colored
Changes since revision 1.209: +2 -1 lines
SVN rev 217555 on 2011-01-18 21:14:18Z by mdf

Specify a CTLTYPE_FOO so that a future sysctl(8) change does not need
to rely on the format string.

Revision 1.201.2.3: download - view: text, markup, annotated - select for diffs
Tue Jan 11 17:31:59 2011 UTC (12 months, 4 weeks ago) by mdf
Branches: RELENG_8
Diff to: previous 1.201.2.2: preferred, colored; branchpoint 1.201: preferred, colored
Changes since revision 1.201.2.2: +27 -25 lines
SVN rev 217271 on 2011-01-11 17:31:59Z by mdf

MFC r216058 and r216059:

r216058:

Use the SYSCTL_CHILDREN macro in kern_sysctl.c to help de-obfuscate the
code.

r216059:

Slightly modify the logic in sysctl_find_oid to reduce the indentation.
There should be no functional change.

Revision 1.177.2.8.4.1: download - view: text, markup, annotated - select for diffs
Tue Dec 21 17:10:29 2010 UTC (13 months, 2 weeks ago) by kensmith
Branches: RELENG_7_4
CVS tags: RELENG_7_4_0_RELEASE
Diff to: previous 1.177.2.8: preferred, colored; next MAIN 1.177.2.9: preferred, colored
Changes since revision 1.177.2.8: +0 -0 lines
SVN rev 216618 on 2010-12-21 17:10:29Z by kensmith

Copy stable/7 to releng/7.4 in preparation for FreeBSD-7.4 release.

Approved by:	re (implicit)

Revision 1.201.2.2.6.1: download - view: text, markup, annotated - select for diffs
Tue Dec 21 17:09:25 2010 UTC (13 months, 2 weeks ago) by kensmith
Branches: RELENG_8_2
CVS tags: RELENG_8_2_0_RELEASE
Diff to: previous 1.201.2.2: preferred, colored; next MAIN 1.201.2.3: preferred, colored
Changes since revision 1.201.2.2: +0 -0 lines
SVN rev 216617 on 2010-12-21 17:09:25Z by kensmith

Copy stable/8 to releng/8.2 in preparation for FreeBSD-8.2 release.

Approved by:	re (implicit)

Revision 1.209: download - view: text, markup, annotated - select for diffs
Mon Nov 29 21:53:21 2010 UTC (14 months, 1 week ago) by mdf
Branches: MAIN
Diff to: previous 1.208: preferred, colored
Changes since revision 1.208: +1 -1 lines
SVN rev 216066 on 2010-11-29 21:53:21Z by mdf

Fix uninitialized variable warning that shows on Tinderbox but not my
setup. (??)

Submitted by:	Michael Butler <imb at protected-networks dot net>

Revision 1.208: download - view: text, markup, annotated - select for diffs
Mon Nov 29 18:18:07 2010 UTC (14 months, 1 week ago) by mdf
Branches: MAIN
Diff to: previous 1.207: preferred, colored
Changes since revision 1.207: +67 -27 lines
SVN rev 216060 on 2010-11-29 18:18:07Z by mdf

Do not hold the sysctl lock across a call to the handler.  This fixes a
general LOR issue where the sysctl lock had no good place in the
hierarchy.  One specific instance is #284 on
http://sources.zabbadoz.net/freebsd/lor.html .

Reviewed by:	jhb
MFC after:	1 month
X-MFC-note:	split oid_refcnt field for oid_running to preserve KBI

Revision 1.207: download - view: text, markup, annotated - select for diffs
Mon Nov 29 18:18:00 2010 UTC (14 months, 1 week ago) by mdf
Branches: MAIN
Diff to: previous 1.206: preferred, colored
Changes since revision 1.206: +22 -19 lines
SVN rev 216059 on 2010-11-29 18:18:00Z by mdf

Slightly modify the logic in sysctl_find_oid to reduce the indentation.
There should be no functional change.

MFC after:	3 days

Revision 1.206: download - view: text, markup, annotated - select for diffs
Mon Nov 29 18:17:53 2010 UTC (14 months, 1 week ago) by mdf
Branches: MAIN
Diff to: previous 1.205: preferred, colored
Changes since revision 1.205: +6 -7 lines
SVN rev 216058 on 2010-11-29 18:17:53Z by mdf

Use the SYSCTL_CHILDREN macro in kern_sysctl.c to help de-obfuscate the
code.

MFC after:	3 days

Revision 1.205: download - view: text, markup, annotated - select for diffs
Thu Sep 16 16:13:12 2010 UTC (16 months, 3 weeks ago) by mdf
Branches: MAIN
Diff to: previous 1.204: preferred, colored
Changes since revision 1.204: +28 -0 lines
SVN rev 212750 on 2010-09-16 16:13:12Z by mdf

Re-add r212370 now that the LOR in powerpc64 has been resolved:

Add a drain function for struct sysctl_req, and use it for a variety
of handlers, some of which had to do awkward things to get a large
enough SBUF_FIXEDLEN buffer.

Note that some sysctl handlers were explicitly outputting a trailing
NUL byte.  This behaviour was preserved, though it should not be
necessary.

Reviewed by:    phk (original patch)

Revision 1.204: download - view: text, markup, annotated - select for diffs
Mon Sep 13 18:48:23 2010 UTC (16 months, 3 weeks ago) by mdf
Branches: MAIN
Diff to: previous 1.203: preferred, colored
Changes since revision 1.203: +0 -28 lines
SVN rev 212572 on 2010-09-13 18:48:23Z by mdf

Revert r212370, as it causes a LOR on powerpc.  powerpc does a few
unexpected things in copyout(9) and so wiring the user buffer is not
sufficient to perform a copyout(9) while holding a random mutex.

Requested by: nwhitehorn

Revision 1.203: download - view: text, markup, annotated - select for diffs
Thu Sep 9 18:33:46 2010 UTC (17 months ago) by mdf
Branches: MAIN
Diff to: previous 1.202: preferred, colored
Changes since revision 1.202: +28 -0 lines
SVN rev 212370 on 2010-09-09 18:33:46Z by mdf

Add a drain function for struct sysctl_req, and use it for a variety of
handlers, some of which had to do awkward things to get a large enough
FIXEDLEN buffer.

Note that some sysctl handlers were explicitly outputting a trailing NUL
byte.  This behaviour was preserved, though it should not be necessary.

Reviewed by:	phk

Revision 1.201.2.2.4.1: download - view: text, markup, annotated - select for diffs
Mon Jun 14 02:09:06 2010 UTC (19 months, 3 weeks ago) by kensmith
Branches: RELENG_8_1
CVS tags: RELENG_8_1_0_RELEASE
Diff to: previous 1.201.2.2: preferred, colored; next MAIN 1.201.2.3: preferred, colored
Changes since revision 1.201.2.2: +0 -0 lines
SVN rev 209145 on 2010-06-14 02:09:06Z by kensmith

Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.

Approved by:	re (implicit)

Revision 1.177.2.8.2.1: download - view: text, markup, annotated - select for diffs
Wed Feb 10 00:26:20 2010 UTC (23 months, 4 weeks ago) by kensmith
Branches: RELENG_7_3
CVS tags: RELENG_7_3_0_RELEASE
Diff to: previous 1.177.2.8: preferred, colored; next MAIN 1.177.2.9: preferred, colored
Changes since revision 1.177.2.8: +0 -0 lines
SVN rev 203736 on 2010-02-10 00:26:20Z by kensmith

Copy stable/7 to releng/7.3 as part of the 7.3-RELEASE process.

Approved by:	re (implicit)

Revision 1.201.2.2.2.1: download - view: text, markup, annotated - select for diffs
Sun Oct 25 01:10:29 2009 UTC (2 years, 3 months ago) by kensmith
Branches: RELENG_8_0
CVS tags: RELENG_8_0_0_RELEASE
Diff to: previous 1.201.2.2: preferred, colored; next MAIN 1.201.2.3: preferred, colored
Changes since revision 1.201.2.2: +0 -0 lines
SVN rev 198460 on 2009-10-25 01:10:29Z by kensmith

Copy stable/8 to releng/8.0 as part of 8.0-RELEASE release procedure.

Approved by:	re (implicit)

Revision 1.201.2.2: download - view: text, markup, annotated - select for diffs
Thu Aug 13 10:31:02 2009 UTC (2 years, 5 months ago) by bz
Branches: RELENG_8
CVS tags: RELENG_8_2_BP, RELENG_8_1_BP, RELENG_8_0_BP
Branch point for: RELENG_8_2, RELENG_8_1, RELENG_8_0
Diff to: previous 1.201.2.1: preferred, colored; branchpoint 1.201: preferred, colored
Changes since revision 1.201.2.1: +10 -2 lines
SVN rev 196178 on 2009-08-13 10:31:02Z by bz

MFC r196176:

  Make it possible to change the vnet sysctl variables on jails
  with their own virtual network stack. Jails only inheriting a
  network stack cannot change anything that cannot be changed from
  within a prison.

  Reviewed by:  rwatson, zec

Approved by:	re (kib)

Revision 1.202: download - view: text, markup, annotated - select for diffs
Thu Aug 13 10:26:34 2009 UTC (2 years, 5 months ago) by bz
Branches: MAIN
Diff to: previous 1.201: preferred, colored
Changes since revision 1.201: +10 -2 lines
SVN rev 196176 on 2009-08-13 10:26:34Z by bz

Make it possible to change the vnet sysctl variables on jails
with their own virtual network stack. Jails only inheriting a
network stack cannot change anything that cannot be changed from
within a prison.

Reviewed by:	rwatson, zec
Approved by:	re (kib)

Revision 1.201.2.1: download - view: text, markup, annotated - select for diffs
Mon Aug 3 08:13:06 2009 UTC (2 years, 6 months ago) by kensmith
Branches: RELENG_8
Diff to: previous 1.201: preferred, colored
Changes since revision 1.201: +0 -0 lines
SVN rev 196045 on 2009-08-03 08:13:06Z by kensmith

Copy head to stable/8 as part of 8.0 Release cycle.

Approved by:	re (Implicit)

Revision 1.201: download - view: text, markup, annotated - select for diffs
Sat Aug 1 19:26:27 2009 UTC (2 years, 6 months ago) by rwatson
Branches: MAIN
CVS tags: RELENG_8_BP
Branch point for: RELENG_8
Diff to: previous 1.200: preferred, colored
Changes since revision 1.200: +0 -1 lines
SVN rev 196019 on 2009-08-01 19:26:27Z by rwatson

Merge the remainder of kern_vimage.c and vimage.h into vnet.c and
vnet.h, we now use jails (rather than vimages) as the abstraction
for virtualization management, and what remained was specific to
virtual network stacks.  Minor cleanups are done in the process,
and comments updated to reflect these changes.

Reviewed by:	bz
Approved by:	re (vimage blanket)

Revision 1.200: download - view: text, markup, annotated - select for diffs
Tue Jul 21 21:58:55 2009 UTC (2 years, 6 months ago) by bz
Branches: MAIN
Diff to: previous 1.199: preferred, colored
Changes since revision 1.199: +0 -5 lines
SVN rev 195814 on 2009-07-21 21:58:55Z by bz

sysctl_msec_to_ticks is used with both virtualized and
non-vrtiualized sysctls so we cannot used one common function.

Add a macro to convert the arg1 in the virtualized case to
vnet.h to not expose the maths to all over the code.

Add a wrapper for the single virtualized call, properly handling
arg1 and call the default implementation from there.

Convert the two over places to use the new macro.

Reviewed by:	rwatson
Approved by:	re (kib)

Revision 1.199: download - view: text, markup, annotated - select for diffs
Tue Jul 14 22:48:30 2009 UTC (2 years, 6 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.198: preferred, colored
Changes since revision 1.198: +8 -97 lines
SVN rev 195699 on 2009-07-14 22:48:30Z by rwatson

Build on Jeff Roberson's linker-set based dynamic per-CPU allocator
(DPCPU), as suggested by Peter Wemm, and implement a new per-virtual
network stack memory allocator.  Modify vnet to use the allocator
instead of monolithic global container structures (vinet, ...).  This
change solves many binary compatibility problems associated with
VIMAGE, and restores ELF symbols for virtualized global variables.

Each virtualized global variable exists as a "reference copy", and also
once per virtual network stack.  Virtualized global variables are
tagged at compile-time, placing the in a special linker set, which is
loaded into a contiguous region of kernel memory.  Virtualized global
variables in the base kernel are linked as normal, but those in modules
are copied and relocated to a reserved portion of the kernel's vnet
region with the help of a the kernel linker.

Virtualized global variables exist in per-vnet memory set up when the
network stack instance is created, and are initialized statically from
the reference copy.  Run-time access occurs via an accessor macro, which
converts from the current vnet and requested symbol to a per-vnet
address.  When "options VIMAGE" is not compiled into the kernel, normal
global ELF symbols will be used instead and indirection is avoided.

This change restores static initialization for network stack global
variables, restores support for non-global symbols and types, eliminates
the need for many subsystem constructors, eliminates large per-subsystem
structures that caused many binary compatibility issues both for
monitoring applications (netstat) and kernel modules, removes the
per-function INIT_VNET_*() macros throughout the stack, eliminates the
need for vnet_symmap ksym(2) munging, and eliminates duplicate
definitions of virtualized globals under VIMAGE_GLOBALS.

Bump __FreeBSD_version and update UPDATING.

Portions submitted by:  bz
Reviewed by:            bz, zec
Discussed with:         gnn, jamie, jeff, jhb, julian, sam
Suggested by:           peter
Approved by:            re (kensmith)

Revision 1.198: download - view: text, markup, annotated - select for diffs
Wed Jun 17 15:01:01 2009 UTC (2 years, 7 months ago) by bz
Branches: MAIN
Diff to: previous 1.197: preferred, colored
Changes since revision 1.197: +1 -0 lines
SVN rev 194368 on 2009-06-17 15:01:01Z by bz

Add explicit includes for jail.h to the files that need them and
remove the "hidden" one from vimage.h.

Revision 1.197: download - view: text, markup, annotated - select for diffs
Mon Jun 15 19:01:53 2009 UTC (2 years, 7 months ago) by jamie
Branches: MAIN
Diff to: previous 1.196: preferred, colored
Changes since revision 1.196: +1 -1 lines
SVN rev 194252 on 2009-06-15 19:01:53Z by jamie

Get vnets from creds instead of threads where they're available, and from
passed threads instead of curthread.

Reviewed by:	zec, julian
Approved by:	bz (mentor)

Revision 1.196: download - view: text, markup, annotated - select for diffs
Fri Jun 5 14:55:22 2009 UTC (2 years, 8 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.195: preferred, colored
Changes since revision 1.195: +0 -1 lines
SVN rev 193511 on 2009-06-05 14:55:22Z by rwatson

Move "options MAC" from opt_mac.h to opt_global.h, as it's now in GENERIC
and used in a large number of files, but also because an increasing number
of incorrect uses of MAC calls were sneaking in due to copy-and-paste of
MAC-aware code without the associated opt_mac.h include.

Discussed with:	pjd

Revision 1.177.2.8: download - view: text, markup, annotated - select for diffs
Thu May 21 14:51:31 2009 UTC (2 years, 8 months ago) by jhb
Branches: RELENG_7
CVS tags: RELENG_7_4_BP, RELENG_7_3_BP
Branch point for: RELENG_7_4, RELENG_7_3
Diff to: previous 1.177.2.7: preferred, colored; branchpoint 1.177: preferred, colored
Changes since revision 1.177.2.7: +16 -7 lines
SVN rev 192538 on 2009-05-21 14:51:31Z by jhb

MFC: Use a separate sx lock to try to limit wiring too much user memory for
userland sysctl requests.  "Small" userland requests can now run
concurrently.

Revision 1.195: download - view: text, markup, annotated - select for diffs
Fri May 15 21:34:58 2009 UTC (2 years, 8 months ago) by des
Branches: MAIN
Diff to: previous 1.194: preferred, colored
Changes since revision 1.194: +1 -12 lines
SVN rev 192160 on 2009-05-15 21:34:58Z by des

Remove do-nothing code that was required to dirty the old buffer on Alpha.

Coverity ID:	838
Approved by:	jhb, alc

Revision 1.177.2.7: download - view: text, markup, annotated - select for diffs
Fri May 15 20:58:52 2009 UTC (2 years, 8 months ago) by jhb
Branches: RELENG_7
Diff to: previous 1.177.2.6: preferred, colored; branchpoint 1.177: preferred, colored
Changes since revision 1.177.2.6: +10 -1 lines
SVN rev 192157 on 2009-05-15 20:58:52Z by jhb

MFC: Add a new type of KTRACE record for sysctl(3) invocations.

Revision 1.194: download - view: text, markup, annotated - select for diffs
Fri May 15 14:41:44 2009 UTC (2 years, 8 months ago) by kib
Branches: MAIN
Diff to: previous 1.193: preferred, colored
Changes since revision 1.193: +3 -5 lines
SVN rev 192144 on 2009-05-15 14:41:44Z by kib

Revert r192094. The revision caused problems for sysctl(3) consumers
that expect that oldlen is filled with required buffer length even when
supplied buffer is too short and returned error is ENOMEM.

Redo the fix for kern.proc.filedesc, by reverting the req->oldidx when
remaining buffer space is too short for the current kinfo_file structure.
Also, only ignore ENOMEM. We have to convert ENOMEM to no error condition
to keep existing interface for the sysctl, though.

Reported by:	ed, Florian Smeets <flo kasimir com>
Tested by:	pho

Revision 1.193: download - view: text, markup, annotated - select for diffs
Thu May 14 22:01:32 2009 UTC (2 years, 8 months ago) by jhb
Branches: MAIN
Diff to: previous 1.192: preferred, colored
Changes since revision 1.192: +16 -7 lines
SVN rev 192125 on 2009-05-14 22:01:32Z by jhb

- Use a separate sx lock to try to limit the number of concurrent userland
  sysctl requests to avoid wiring too much user memory.  Only grab this
  lock if the user's old buffer is larger than a page as a tradeoff to
  allow more concurrency for common small requests.
- Just use a shared lock on the sysctl tree for user sysctl requests now.

MFC after:	1 week

Revision 1.192: download - view: text, markup, annotated - select for diffs
Thu May 14 10:54:57 2009 UTC (2 years, 8 months ago) by kib
Branches: MAIN
Diff to: previous 1.191: preferred, colored
Changes since revision 1.191: +5 -3 lines
SVN rev 192094 on 2009-05-14 10:54:57Z by kib

Do not advance req->oldidx when sysctl_old_user returning an
error due to copyout failure or short buffer.

The later breaks the usermode iterators of the sysctl results that pack
arbitrary number of variable-sized structures. Iterator expects that
kernel filled exactly oldlen bytes, and tries to interpret half-filled
or garbage structure at the end of the buffer. In particular,
kinfo_getfile(3) segfaulted.

Reported and tested by:	pho
MFC after:	3 weeks

Revision 1.191: download - view: text, markup, annotated - select for diffs
Thu Apr 30 13:36:26 2009 UTC (2 years, 9 months ago) by zec
Branches: MAIN
Diff to: previous 1.190: preferred, colored
Changes since revision 1.190: +98 -2 lines
SVN rev 191688 on 2009-04-30 13:36:26Z by zec

Permit buiding kernels with options VIMAGE, restricted to only a single
active network stack instance.  Turning on options VIMAGE at compile
time yields the following changes relative to default kernel build:

1) V_ accessor macros for virtualized variables resolve to structure
fields via base pointers, instead of being resolved as fields in global
structs or plain global variables.  As an example, V_ifnet becomes:

    options VIMAGE:          ((struct vnet_net *) vnet_net)->_ifnet
    default build:           vnet_net_0._ifnet
    options VIMAGE_GLOBALS:  ifnet

2) INIT_VNET_* macros will declare and set up base pointers to be used
by V_ accessor macros, instead of resolving to whitespace:

    INIT_VNET_NET(ifp->if_vnet); becomes

    struct vnet_net *vnet_net = (ifp->if_vnet)->mod_data[VNET_MOD_NET];

3) Memory for vnet modules registered via vnet_mod_register() is now
allocated at run time in sys/kern/kern_vimage.c, instead of per vnet
module structs being declared as globals.  If required, vnet modules
can now request the framework to provide them with allocated bzeroed
memory by filling in the vmi_size field in their vmi_modinfo structures.

4) structs socket, ifnet, inpcbinfo, tcpcb and syncache_head are
extended to hold a pointer to the parent vnet.  options VIMAGE builds
will fill in those fields as required.

5) curvnet is introduced as a new global variable in options VIMAGE
builds, always pointing to the default and only struct vnet.

6) struct sysctl_oid has been extended with additional two fields to
store major and minor virtualization module identifiers, oid_v_subs and
oid_v_mod.  SYSCTL_V_* family of macros will fill in those fields
accordingly, and store the offset in the appropriate vnet container
struct in oid_arg1.
In sysctl handlers dealing with virtualized sysctls, the
SYSCTL_RESOLVE_V_ARG1() macro will compute the address of the target
variable and make it available in arg1 variable for further processing.

Unused fields in structs vnet_inet, vnet_inet6 and vnet_ipfw have
been deleted.

Reviewed by:	bz, rwatson
Approved by:	julian (mentor)

Revision 1.177.2.6.2.1: download - view: text, markup, annotated - select for diffs
Wed Apr 15 03:14:26 2009 UTC (2 years, 9 months ago) by kensmith
Branches: RELENG_7_2
CVS tags: RELENG_7_2_0_RELEASE
Diff to: previous 1.177.2.6: preferred, colored; next MAIN 1.177.2.7: preferred, colored
Changes since revision 1.177.2.6: +0 -0 lines
SVN rev 191087 on 2009-04-15 03:14:26Z by kensmith

Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.

Approved by:	re (implicit)

Revision 1.165.2.5: download - view: text, markup, annotated - select for diffs
Fri Mar 20 21:47:26 2009 UTC (2 years, 10 months ago) by kib
Branches: RELENG_6
Diff to: previous 1.165.2.4: preferred, colored; branchpoint 1.165: preferred, colored; next MAIN 1.166: preferred, colored
Changes since revision 1.165.2.4: +6 -2 lines
SVN rev 190179 on 2009-03-20 21:47:26Z by kib

MFC r185983:
The userland_sysctl() function retries sysctl_root() until returned
error is not EAGAIN. Several sysctls that inspect another process use
p_candebug() for checking access right for the curproc. p_candebug()
returns EAGAIN for some reasons, in particular, for the process doing
exec() now. If execing process tries to lock Giant, we get a livelock,
because sysctl handlers are covered by Giant, and often do not sleep.

Break the livelock by dropping Giant and allowing other threads to
execute in the EAGAIN loop.

This commit does not merge the following change, as was discussed with jhb:
[Also, do not return EAGAIN from p_candebug() when process is executing,
use more appropriate EBUSY error.]

MFC r185987:
Uio_yield() already does DROP_GIANT/PICKUP_GIANT, no need to repeat this
around the call.

Tested by:	Eugene Grosbein <eugen kuzbass ru>

Revision 1.177.2.6: download - view: text, markup, annotated - select for diffs
Wed Mar 18 21:54:28 2009 UTC (2 years, 10 months ago) by jhb
Branches: RELENG_7
CVS tags: RELENG_7_2_BP
Branch point for: RELENG_7_2
Diff to: previous 1.177.2.5: preferred, colored; branchpoint 1.177: preferred, colored
Changes since revision 1.177.2.5: +1 -9 lines
SVN rev 189993 on 2009-03-18 21:54:28Z by jhb

MFC: Remove a comment and expand scope of sysctl sx lock a bit to fully
restore limiting of wired memory by userspace for sysctls.

Revision 1.190: download - view: text, markup, annotated - select for diffs
Wed Mar 11 21:48:36 2009 UTC (2 years, 11 months ago) by jhb
Branches: MAIN
Diff to: previous 1.189: preferred, colored
Changes since revision 1.189: +10 -1 lines
SVN rev 189707 on 2009-03-11 21:48:36Z by jhb

Add a new type of KTRACE record for sysctl(3) invocations.  It uses the
internal sysctl_sysctl_name() handler to map the MIB array to a string
name and logs this name in the trace log.  This can be useful to see
exactly which sysctls a thread is invoking.

MFC after:	1 month

Revision 1.177.2.5: download - view: text, markup, annotated - select for diffs
Tue Mar 10 19:33:50 2009 UTC (2 years, 11 months ago) by jhb
Branches: RELENG_7
Diff to: previous 1.177.2.4: preferred, colored; branchpoint 1.177: preferred, colored
Changes since revision 1.177.2.4: +8 -7 lines
SVN rev 189644 on 2009-03-10 19:33:50Z by jhb

MFC: Add a flag to tag individual sysctl leaf nodes as MPSAFE.  Tag the
following nodes as MPSAFE:
- All standalone INT/LONG sysctls.
- kern.proc.*
- All name-cache related sysctls.
- vm.loadavg
- vm.vmtotal
- vm.stats.(sys|vm).*
- sysctl.name2oid
- kern.ident, kern.osrelease, kern.version, etc.
- kern.arandom
- security.jail.jailed
- kern.devname

Other changes:
- Remove GIANT_REQUIRED from vmtotal().
- Add conditional Giant locking around the vrele() in
  sysctl_kern_proc_pathname().

Revision 1.177.2.4: download - view: text, markup, annotated - select for diffs
Tue Mar 10 18:57:10 2009 UTC (2 years, 11 months ago) by jhb
Branches: RELENG_7
Diff to: previous 1.177.2.3: preferred, colored; branchpoint 1.177: preferred, colored
Changes since revision 1.177.2.3: +103 -21 lines
SVN rev 189640 on 2009-03-10 18:57:10Z by jhb

MFC: Expand the scope of the sysctllock sx lock to protect the sysctl tree
itself.  This also includes changes to the ia64 machine check code to
defer adding machine check records to the sysctl tree, removing Giant
from the CAM code that created dynamic sysctls, and tweaking the teardown
of da(4) and cd(4) peripheral devices to not hold locks when freeing the
sysctl tree.

Revision 1.177.2.3: download - view: text, markup, annotated - select for diffs
Tue Mar 10 18:16:03 2009 UTC (2 years, 11 months ago) by jhb
Branches: RELENG_7
Diff to: previous 1.177.2.2: preferred, colored; branchpoint 1.177: preferred, colored
Changes since revision 1.177.2.2: +19 -0 lines
SVN rev 189638 on 2009-03-10 18:16:03Z by jhb

MFC: Add sysctl_rename_oid() and use it in device_set_unit().

Revision 1.177.2.2: download - view: text, markup, annotated - select for diffs
Tue Mar 10 17:28:23 2009 UTC (2 years, 11 months ago) by jhb
Branches: RELENG_7
Diff to: previous 1.177.2.1: preferred, colored; branchpoint 1.177: preferred, colored
Changes since revision 1.177.2.1: +21 -225 lines
SVN rev 189634 on 2009-03-10 17:28:23Z by jhb

MFC: Push down Giant inside sysctl.

Revision 1.189: download - view: text, markup, annotated - select for diffs
Tue Mar 10 17:00:28 2009 UTC (2 years, 11 months ago) by jhb
Branches: MAIN
Diff to: previous 1.188: preferred, colored
Changes since revision 1.188: +1 -9 lines
SVN rev 189631 on 2009-03-10 17:00:28Z by jhb

- Remove a recently added comment from kernel_sysctlbyname() that isn't
  needed.
- Move the release of the sysctl sx lock after the vsunlock() in
  userland_sysctl() to restore the original memlock behavior of
  minimizing the amount of memory wired to handle sysctl requests.

MFC after:	1 week

Revision 1.188: download - view: text, markup, annotated - select for diffs
Fri Feb 6 14:51:32 2009 UTC (3 years ago) by jhb
Branches: MAIN
Diff to: previous 1.187: preferred, colored
Changes since revision 1.187: +103 -21 lines
SVN rev 188232 on 2009-02-06 14:51:32Z by jhb

Expand the scope of the sysctllock sx lock to protect the sysctl tree itself.
Back in 1.1 of kern_sysctl.c the sysctl() routine wired the "old" userland
buffer for most sysctls (everything except kern.vnode.*).  I think to prevent
issues with wiring too much memory it used a 'memlock' to serialize all
sysctl(2) invocations, meaning that only one user buffer could be wired at
a time.  In 5.0 the 'memlock' was converted to an sx lock and renamed to
'sysctl lock'.  However, it still only served the purpose of serializing
sysctls to avoid wiring too much memory and didn't actually protect the
sysctl tree as its name suggested.  These changes expand the lock to actually
protect the tree.

Later on in 5.0, sysctl was changed to not wire buffers for requests by
default (sysctl_handle_opaque() will still wire buffers larger than a single
page, however).  As a result, user buffers are no longer wired as often.
However, many sysctl handlers still wire user buffers, so it is still
desirable to serialize userland sysctl requests.  Kernel sysctl requests
are allowed to run in parallel, however.

- Expose sysctl_lock()/sysctl_unlock() routines to exclusively lock the
  sysctl tree for a few places outside of kern_sysctl.c that manipulate
  the sysctl tree directly including the kernel linker and vfs_register().
- sysctl_register() and sysctl_unregister() require the caller to lock
  the sysctl lock using sysctl_lock() and sysctl_unlock().  The rest of
  the public sysctl API manage the locking internally.
- Add a locked variant of sysctl_remove_oid() for internal use so that
  external uses of the API do not need to be aware of locking requirements.
- The kernel linker no longer needs Giant when manipulating the sysctl
  tree.
- Add a missing break to the loop in vfs_register() so that we stop looking
  at the sysctl MIB once we have changed it.

MFC after:	1 month

Revision 1.187: download - view: text, markup, annotated - select for diffs
Wed Jan 28 19:58:05 2009 UTC (3 years ago) by ed
Branches: MAIN
Diff to: previous 1.186: preferred, colored
Changes since revision 1.186: +4 -3 lines
SVN rev 187864 on 2009-01-28 19:58:05Z by ed

Mark most often used sysctl's as MPSAFE.

After running a `make buildkernel', I noticed most of the Giant locks in
sysctl are only caused by a very small amount of sysctl's:

- sysctl.name2oid. This one is locked by SYSCTL_LOCK, just like
  sysctl.oidfmt.

- kern.ident, kern.osrelease, kern.version, etc. These are just constant
  strings.

- kern.arandom, used by the stack protector. It is already protected by
  arc4_mtx.

I also saw the following sysctl's show up. Not as often as the ones
above, but still quite often:

- security.jail.jailed. Also mark security.jail.list as MPSAFE. They
  don't need locking or already use allprison_lock.

- kern.devname, used by devname(3), ttyname(3), etc.

This seems to reduce Giant locking inside sysctl by ~75% in my primitive
test setup.

Revision 1.186: download - view: text, markup, annotated - select for diffs
Fri Jan 23 22:40:35 2009 UTC (3 years ago) by jhb
Branches: MAIN
Diff to: previous 1.185: preferred, colored
Changes since revision 1.185: +4 -4 lines
SVN rev 187656 on 2009-01-23 22:40:35Z by jhb

Add a flag to tag individual sysctl leaf nodes as MPSAFE and thus not
needing Giant.

Submitted by:	csjp (an older version)

Revision 1.185: download - view: text, markup, annotated - select for diffs
Thu Jan 1 00:19:51 2009 UTC (3 years, 1 month ago) by ed
Branches: MAIN
Diff to: previous 1.184: preferred, colored
Changes since revision 1.184: +5 -2 lines
SVN rev 186664 on 2009-01-01 00:19:51Z by ed

Don't clobber sysctl_root()'s error number.

When sysctl() is being called with a buffer that is too small, it will
return ENOMEM. Unfortunately the changes I made the other day sets the
error number to 0, because it just returns the error number of the
copyout(). Revert this part of the change.

Revision 1.184: download - view: text, markup, annotated - select for diffs
Mon Dec 29 19:24:00 2008 UTC (3 years, 1 month ago) by ed
Branches: MAIN
Diff to: previous 1.183: preferred, colored
Changes since revision 1.183: +0 -211 lines
SVN rev 186570 on 2008-12-29 19:24:00Z by ed

Fix compilation. Also move ogetkerninfo() to kern_xxx.c.

It seems I forgot to remove `int error' from a single piece of code. I'm
also moving ogetkerninfo() to kern_xxx.c, because it belongs to the
class of compat system information system calls, not the generic sysctl
code.

Revision 1.183: download - view: text, markup, annotated - select for diffs
Mon Dec 29 12:58:45 2008 UTC (3 years, 1 month ago) by ed
Branches: MAIN
Diff to: previous 1.182: preferred, colored
Changes since revision 1.182: +23 -19 lines
SVN rev 186564 on 2008-12-29 12:58:45Z by ed

Push down Giant inside sysctl. Also add some more assertions to the code.

In the existing code we didn't really enforce that callers hold Giant
before calling userland_sysctl(), even though there is no guarantee it
is safe. Fix this by just placing Giant locks around the call to the oid
handler. This also means we only pick up Giant for a very short period
of time. Maybe we should add MPSAFE flags to sysctl or phase it out all
together.

I've also added SYSCTL_LOCK_ASSERT(). We have to make sure sysctl_root()
and name2oid() are called with the sysctl lock held.

Reviewed by:	Jille Timmermans <jille quis cx>

Revision 1.177.6.2: download - view: text, markup, annotated - select for diffs
Fri Dec 19 16:08:40 2008 UTC (3 years, 1 month ago) by kib
Branches: RELENG_7_1
CVS tags: RELENG_7_1_0_RELEASE
Diff to: previous 1.177.6.1: preferred, colored; branchpoint 1.177: preferred, colored; next MAIN 1.178: preferred, colored
Changes since revision 1.177.6.1: +6 -2 lines
SVN rev 186328 on 2008-12-19 16:08:40Z by kib

MFC r185983:
The userland_sysctl() function retries sysctl_root() until returned
error is not EAGAIN. Several sysctls that inspect another process use
p_candebug() for checking access right for the curproc. p_candebug()
returns EAGAIN for some reasons, in particular, for the process doing
exec() now. If execing process tries to lock Giant, we get a livelock,
because sysctl handlers are covered by Giant, and often do not sleep.

Break the livelock by dropping Giant and allowing other threads to
execute in the EAGAIN loop.

This commit does not merge the following change, as was discussed with jhb:
[Also, do not return EAGAIN from p_candebug() when process is executing,
use more appropriate EBUSY error.]

MFC r185987:
Uio_yield() already does DROP_GIANT/PICKUP_GIANT, no need to repeat this
around the call.

Approved by:	re (kensmith)

Revision 1.177.2.1: download - view: text, markup, annotated - select for diffs
Fri Dec 19 15:24:18 2008 UTC (3 years, 1 month ago) by kib
Branches: RELENG_7
Diff to: previous 1.177: preferred, colored
Changes since revision 1.177: +6 -2 lines
SVN rev 186324 on 2008-12-19 15:24:18Z by kib

MFC r185983:
The userland_sysctl() function retries sysctl_root() until returned
error is not EAGAIN. Several sysctls that inspect another process use
p_candebug() for checking access right for the curproc. p_candebug()
returns EAGAIN for some reasons, in particular, for the process doing
exec() now. If execing process tries to lock Giant, we get a livelock,
because sysctl handlers are covered by Giant, and often do not sleep.

Break the livelock by dropping Giant and allowing other threads to
execute in the EAGAIN loop.

This commit does not merge the following change, as was discussed with jhb:
[Also, do not return EAGAIN from p_candebug() when process is executing,
use more appropriate EBUSY error.]

MFC r185987:
Uio_yield() already does DROP_GIANT/PICKUP_GIANT, no need to repeat this
around the call.

Approved by:	re (kensmith)

Revision 1.182: download - view: text, markup, annotated - select for diffs
Fri Dec 12 14:03:04 2008 UTC (3 years, 1 month ago) by kib
Branches: MAIN
Diff to: previous 1.181: preferred, colored
Changes since revision 1.181: +0 -2 lines
SVN rev 185987 on 2008-12-12 14:03:04Z by kib

Uio_yield() already does DROP_GIANT/PICKUP_GIANT, no need to repeat this
around the call.

Noted by:  bde

Revision 1.181: download - view: text, markup, annotated - select for diffs
Fri Dec 12 12:06:28 2008 UTC (3 years, 1 month ago) by kib
Branches: MAIN
Diff to: previous 1.180: preferred, colored
Changes since revision 1.180: +8 -2 lines
SVN rev 185983 on 2008-12-12 12:06:28Z by kib

The userland_sysctl() function retries sysctl_root() until returned
error is not EAGAIN. Several sysctls that inspect another process use
p_candebug() for checking access right for the curproc. p_candebug()
returns EAGAIN for some reasons, in particular, for the process doing
exec() now. If execing process tries to lock Giant, we get a livelock,
because sysctl handlers are covered by Giant, and often do not sleep.

Break the livelock by dropping Giant and allowing other threads to
execute in the EAGAIN loop.

Also, do not return EAGAIN from p_candebug() when process is executing,
use more appropriate EBUSY error [1].

Reported and tested by:	pho
Suggested by:	rwatson [1]
Reviewed by:	rwatson, des
MFC after:	1 week

Revision 1.180: download - view: text, markup, annotated - select for diffs
Wed Nov 26 22:32:07 2008 UTC (3 years, 2 months ago) by zec
Branches: MAIN
Diff to: previous 1.179: preferred, colored
Changes since revision 1.179: +3 -0 lines
SVN rev 185348 on 2008-11-26 22:32:07Z by zec

Merge more of currently non-functional (i.e. resolving to
whitespace) macros from p4/vimage branch.

Do a better job at enclosing all instantiations of globals
scheduled for virtualization in #ifdef VIMAGE_GLOBALS blocks.

De-virtualize and mark as const saorder_state_alive and
saorder_state_any arrays from ipsec code, given that they are never
updated at runtime, so virtualizing them would be pointless.

Reviewed by:  bz, julian
Approved by:  julian (mentor)
Obtained from:        //depot/projects/vimage-commit2/...
X-MFC after:  never
Sponsored by: NLnet Foundation, The FreeBSD Foundation

Revision 1.177.6.1: download - view: text, markup, annotated - select for diffs
Tue Nov 25 02:59:29 2008 UTC (3 years, 2 months ago) by kensmith
Branches: RELENG_7_1
Diff to: previous 1.177: preferred, colored
Changes since revision 1.177: +0 -0 lines
SVN rev 185281 on 2008-11-25 02:59:29Z by kensmith

Create releng/7.1 in preparation for moving into RC phase of 7.1 release
cycle.

Approved by:	re (implicit)

Revision 1.165.2.4.6.1: download - view: text, markup, annotated - select for diffs
Thu Oct 2 02:57:24 2008 UTC (3 years, 4 months ago) by kensmith
Branches: RELENG_6_4
CVS tags: RELENG_6_4_0_RELEASE
Diff to: previous 1.165.2.4: preferred, colored; next MAIN 1.165.2.5: preferred, colored
Changes since revision 1.165.2.4: +0 -0 lines
SVN rev 183531 on 2008-10-02 02:57:24Z by kensmith

Create releng/6.4 from stable/6 in preparation for 6.4-RC1.

Approved by:	re (implicit)

Revision 1.179: download - view: text, markup, annotated - select for diffs
Fri Nov 30 21:29:08 2007 UTC (4 years, 2 months ago) by peter
Branches: MAIN
Diff to: previous 1.178: preferred, colored
Changes since revision 1.178: +19 -0 lines
Add sysctl_rename_oid() to support device_set_unit() usage.  Otherwise,
when unit numbers are changed, the sysctl devinfo tree gets out of sync
and duplicate trees are attempted to be attached with the original name.

Revision 1.178: download - view: text, markup, annotated - select for diffs
Wed Oct 24 19:03:54 2007 UTC (4 years, 3 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.177: preferred, colored
Changes since revision 1.177: +1 -1 lines
Merge first in a series of TrustedBSD MAC Framework KPI changes
from Mac OS X Leopard--rationalize naming for entry points to
the following general forms:

  mac_<object>_<method/action>
  mac_<object>_check_<method/action>

The previous naming scheme was inconsistent and mostly
reversed from the new scheme.  Also, make object types more
consistent and remove spaces from object types that contain
multiple parts ("posix_sem" -> "posixsem") to make mechanical
parsing easier.  Introduce a new "netinet" object type for
certain IPv4/IPv6-related methods.  Also simplify, slightly,
some entry point names.

All MAC policy modules will need to be recompiled, and modules
not updates as part of this commit will need to be modified to
conform to the new KPI.

Sponsored by:	SPARTA (original patches against Mac OS X)
Obtained from:	TrustedBSD Project, Apple Computer

Revision 1.177: download - view: text, markup, annotated - select for diffs
Sun Sep 2 09:59:33 2007 UTC (4 years, 5 months ago) by rwatson
Branches: MAIN
CVS tags: RELENG_7_BP, RELENG_7_1_BP, RELENG_7_0_BP, RELENG_7_0_0_RELEASE, RELENG_7_0
Branch point for: RELENG_7_1, RELENG_7
Diff to: previous 1.176: preferred, colored
Changes since revision 1.176: +1 -1 lines
In userland_sysctl(), call useracc() with the actual newlen value to be
used, rather than the one passed via 'req', which may not reflect a
rewrite.  This call to useracc() is redundant to validation performed by
later copyin()/copyout() calls, so there isn't a security issue here,
but this could technically lead to excessive validation of addresses if
the length in newlen is shorter than req.newlen.

Approved by:	re (kensmith)
Reviewed by:	jhb
Submitted by:	Constantine A. Murenin <cnst+freebsd@bugmail.mojo.ru>
Sponsored by:	Google Summer of Code 2007

Revision 1.176: download - view: text, markup, annotated - select for diffs
Tue Jun 12 00:11:59 2007 UTC (4 years, 8 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.175: preferred, colored
Changes since revision 1.175: +1 -2 lines
Eliminate now-unused SUSER_ALLOWJAIL arguments to priv_check_cred(); in
some cases, move to priv_check() if it was an operation on a thread and
no other flags were present.

Eliminate caller-side jail exception checking (also now-unused); jail
privilege exception code now goes solely in kern_jail.c.

We can't yet eliminate suser() due to some cases in the KAME code where
a privilege check is performed and then used in many different deferred
paths.  Do, however, move those prototypes to priv.h.

Reviewed by:	csjp
Obtained from:	TrustedBSD Project

Revision 1.175: download - view: text, markup, annotated - select for diffs
Mon Jun 4 18:14:28 2007 UTC (4 years, 8 months ago) by dwmalone
Branches: MAIN
Diff to: previous 1.174: preferred, colored
Changes since revision 1.174: +25 -0 lines
Add a function for exporting 64 bit types.

Revision 1.174: download - view: text, markup, annotated - select for diffs
Mon Mar 5 13:10:57 2007 UTC (4 years, 11 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.173: preferred, colored
Changes since revision 1.173: +1 -2 lines
Further system call comment cleanup:

- Remove also "MP SAFE" after prior "MPSAFE" pass. (suggested by bde)
- Remove extra blank lines in some cases.
- Add extra blank lines in some cases.
- Remove no-op comments consisting solely of the function name, the word
  "syscall", or the system call name.
- Add punctuation.
- Re-wrap some comments.

Revision 1.173: download - view: text, markup, annotated - select for diffs
Sun Mar 4 22:36:46 2007 UTC (4 years, 11 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.172: preferred, colored
Changes since revision 1.172: +0 -6 lines
Remove 'MPSAFE' annotations from the comments above most system calls: all
system calls now enter without Giant held, and then in some cases, acquire
Giant explicitly.

Remove a number of other MPSAFE annotations in the credential code and
tweak one or two other adjacent comments.

Revision 1.172: download - view: text, markup, annotated - select for diffs
Mon Nov 6 13:42:01 2006 UTC (5 years, 3 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.171: preferred, colored
Changes since revision 1.171: +5 -6 lines
Sweep kernel replacing suser(9) calls with priv(9) calls, assigning
specific privilege names to a broad range of privileges.  These may
require some future tweaking.

Sponsored by:           nCircle Network Security, Inc.
Obtained from:          TrustedBSD Project
Discussed on:           arch@
Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri,
                        Alex Lyashkov <umka at sevcity dot net>,
                        Skip Ford <skip dot ford at verizon dot net>,
                        Antoine Brodin <antoine dot brodin at laposte dot net>

Revision 1.171: download - view: text, markup, annotated - select for diffs
Sun Oct 22 11:52:13 2006 UTC (5 years, 3 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.170: preferred, colored
Changes since revision 1.170: +3 -1 lines
Complete break-out of sys/sys/mac.h into sys/security/mac/mac_framework.h
begun with a repo-copy of mac.h to mac_framework.h.  sys/mac.h now
contains the userspace and user<->kernel API and definitions, with all
in-kernel interfaces moved to mac_framework.h, which is now included
across most of the kernel instead.

This change is the first step in a larger cleanup and sweep of MAC
Framework interfaces in the kernel, and will not be MFC'd.

Obtained from:	TrustedBSD Project
Sponsored by:	SPARTA

Revision 1.165.2.4: download - view: text, markup, annotated - select for diffs
Mon Aug 7 10:12:56 2006 UTC (5 years, 6 months ago) by yar
Branches: RELENG_6
CVS tags: RELENG_6_4_BP, RELENG_6_3_BP, RELENG_6_3_0_RELEASE, RELENG_6_3, RELENG_6_2_BP, RELENG_6_2_0_RELEASE, RELENG_6_2
Branch point for: RELENG_6_4
Diff to: previous 1.165.2.3: preferred, colored; branchpoint 1.165: preferred, colored
Changes since revision 1.165.2.3: +0 -4 lines
MFC r1.170:

  Kill an XXX remark that has been untrue since rev. 1.150 of this file.

Revision 1.170: download - view: text, markup, annotated - select for diffs
Fri Jun 16 07:36:18 2006 UTC (5 years, 7 months ago) by yar
Branches: MAIN
Diff to: previous 1.169: preferred, colored
Changes since revision 1.169: +0 -4 lines
Kill an XXX remark that has been untrue since rev. 1.150 of this file.

Revision 1.165.2.3: download - view: text, markup, annotated - select for diffs
Wed Mar 1 21:08:53 2006 UTC (5 years, 11 months ago) by andre
Branches: RELENG_6
CVS tags: RELENG_6_1_BP, RELENG_6_1_0_RELEASE, RELENG_6_1
Diff to: previous 1.165.2.2: preferred, colored; branchpoint 1.165: preferred, colored
Changes since revision 1.165.2.2: +26 -0 lines
MFC: Make sysctl_msec_to_ticks(SYSCTL_HANDLER_ARGS) generally available instead
of being private to tcp_timer.c.

Sponsored by:	TCP/IP Optimization Fundraise 2005
Approved by:	re (scottl)

Revision 1.169: download - view: text, markup, annotated - select for diffs
Thu Feb 16 15:40:35 2006 UTC (5 years, 11 months ago) by andre
Branches: MAIN
Diff to: previous 1.168: preferred, colored
Changes since revision 1.168: +26 -0 lines
Make sysctl_msec_to_ticks(SYSCTL_HANDLER_ARGS) generally available instead
of being private to tcp_timer.c.

Sponsored by:	TCP/IP Optimization Fundraise 2005
MFC after:	3 days

Revision 1.159.2.2: download - view: text, markup, annotated - select for diffs
Sat Jan 28 00:43:53 2006 UTC (6 years ago) by truckman
Branches: RELENG_5
CVS tags: RELENG_5_5_BP, RELENG_5_5_0_RELEASE, RELENG_5_5
Diff to: previous 1.159.2.1: preferred, colored; branchpoint 1.159: preferred, colored; next MAIN 1.160: preferred, colored
Changes since revision 1.159.2.1: +12 -1 lines
MFC kern_sysctl.c 1.168

  Touch all the pages wired by sysctl_wire_old_buffer() to avoid PTE
  modified bit emulation traps on Alpha while holding locks in the
  sysctl handler.

Revision 1.165.2.2: download - view: text, markup, annotated - select for diffs
Sat Jan 28 00:31:56 2006 UTC (6 years ago) by truckman
Branches: RELENG_6
Diff to: previous 1.165.2.1: preferred, colored; branchpoint 1.165: preferred, colored
Changes since revision 1.165.2.1: +12 -1 lines
MFC kern_sysctl.c 1.168

  Touch all the pages wired by sysctl_wire_old_buffer() to avoid PTE
  modified bit emulation traps on Alpha while holding locks in the
  sysctl handler.

Revision 1.168: download - view: text, markup, annotated - select for diffs
Wed Jan 25 01:03:34 2006 UTC (6 years ago) by truckman
Branches: MAIN
Diff to: previous 1.167: preferred, colored
Changes since revision 1.167: +12 -1 lines
Touch all the pages wired by sysctl_wire_old_buffer() to avoid PTE
modified bit emulation traps on Alpha while holding locks in the
sysctl handler.

A better solution would be to pass a hint to the Alpha pmap code to
tell mark these pages as modified when they as they are being wired,
but that appears to be more difficult to implement.

Suggested by: jhb
MFC after:	3 days

Revision 1.165.2.1: download - view: text, markup, annotated - select for diffs
Fri Aug 19 04:50:08 2005 UTC (6 years, 5 months ago) by csjp
Branches: RELENG_6
CVS tags: RELENG_6_0_BP, RELENG_6_0_0_RELEASE, RELENG_6_0
Diff to: previous 1.165: preferred, colored
Changes since revision 1.165: +8 -1 lines
Synch with HEAD:

MFC revision 1.167
date: 2005/08/08 21:06:42;  author: csjp;  state: Exp;  lines: +2 -0
Drop in a WITNESS_WARN into SYSCTL_IN to make sure that we are
not holding any non-sleep-able-locks locks when copyin is called.
This gets executed un-conditionally since we have no function
to wire the buffer in this direction.

MFC revision 1.166
date: 2005/08/08 18:54:35;  author: csjp;  state: Exp;  lines: +6 -1
Check to see if we wired the user-supplied buffers in SYSCTL_OUT, if
the buffer has not been wired and we are holding any non-sleep-able locks,
drop a witness warning. If the buffer has not been wired, it is possible
that the writing of the data can sleep, especially if the page is not in
memory. This can result in a number of different locking issues, including
dead locks.

Approved by:	re (kensmith)

Revision 1.167: download - view: text, markup, annotated - select for diffs
Mon Aug 8 21:06:42 2005 UTC (6 years, 6 months ago) by csjp
Branches: MAIN
Diff to: previous 1.166: preferred, colored
Changes since revision 1.166: +2 -0 lines
Drop in a WITNESS_WARN into SYSCTL_IN to make sure that we are
not holding any non-sleep-able-locks locks when copyin is called.
This gets executed un-conditionally since we have no function
to wire the buffer in this direction.

Pointed out by:	truckman
MFC after:	1 week

Revision 1.166: download - view: text, markup, annotated - select for diffs
Mon Aug 8 18:54:35 2005 UTC (6 years, 6 months ago) by csjp
Branches: MAIN
Diff to: previous 1.165: preferred, colored
Changes since revision 1.165: +6 -1 lines
Check to see if we wired the user-supplied buffers in SYSCTL_OUT, if
the buffer has not been wired and we are holding any non-sleep-able locks,
drop a witness warning. If the buffer has not been wired, it is possible
that the writing of the data can sleep, especially if the page is not in
memory. This can result in a number of different locking issues, including
dead locks.

MFC after:	1 week
Discussed with:	rwatson
Reviewed by:	jhb

Revision 1.159.2.1: download - view: text, markup, annotated - select for diffs
Sun Feb 13 14:13:53 2005 UTC (6 years, 11 months ago) by rwatson
Branches: RELENG_5
CVS tags: RELENG_5_4_BP, RELENG_5_4_0_RELEASE, RELENG_5_4
Diff to: previous 1.159: preferred, colored
Changes since revision 1.159: +2 -0 lines
Merge kern_sysctl.c:1.162, options:1.486 and NOTES:1.1285 from HEAD
to RELENG_5:

  date: 2004/10/27 19:26:01;  author: rwatson;  state: Exp;  lines: +2 -0
  date: 2004/10/27 19:26:01;  author: rwatson;  state: Exp;  lines: +1 -0
  date: 2004/10/27 19:26:01;  author: rwatson;  state: Exp;  lines: +8 -0
  Move the 'debug' sysctl tree under options SYSCTL_DEBUG.  It generates
  an inordinate amount of synchronous console output that is fairly
  undesirable on slower serial console.  It's easily hit by accident
  when frobbing other sysctls late at night.

Revision 1.165: download - view: text, markup, annotated - select for diffs
Thu Feb 10 12:16:08 2005 UTC (7 years ago) by phk
Branches: MAIN
CVS tags: RELENG_6_BP
Branch point for: RELENG_6
Diff to: previous 1.164: preferred, colored
Changes since revision 1.164: +4 -4 lines
Make another bunch of SYSCTL_NODEs static

Revision 1.164: download - view: text, markup, annotated - select for diffs
Mon Feb 7 07:40:39 2005 UTC (7 years ago) by phk
Branches: MAIN
Diff to: previous 1.163: preferred, colored
Changes since revision 1.163: +7 -7 lines
Add a missing prefix to a struct field for consistency.

Revision 1.163: download - view: text, markup, annotated - select for diffs
Fri Dec 31 14:52:53 2004 UTC (7 years, 1 month ago) by pjd
Branches: MAIN
Diff to: previous 1.162: preferred, colored
Changes since revision 1.162: +15 -15 lines
Be consistent and always use form 'return (value);' instead of 'return value;'.
We had (before this change) 84 lines where it was style(9)-clean and 15 lines
where it was not.

Revision 1.162: download - view: text, markup, annotated - select for diffs
Wed Oct 27 19:26:01 2004 UTC (7 years, 3 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.161: preferred, colored
Changes since revision 1.161: +2 -0 lines
Move the 'debug' sysctl tree under options SYSCTL_DEBUG.  It generates
an inordinate amount of synchronous console output that is fairly
undesirable on slower serial console.  It's easily hit by accident
when frobbing other sysctls late at night.

Revision 1.161: download - view: text, markup, annotated - select for diffs
Tue Oct 12 07:49:15 2004 UTC (7 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.160: preferred, colored
Changes since revision 1.160: +7 -7 lines
Add missing zero flag arguments to calls to userland_sysctl()

Revision 1.160: download - view: text, markup, annotated - select for diffs
Mon Oct 11 22:04:15 2004 UTC (7 years, 4 months ago) by peter
Branches: MAIN
Diff to: previous 1.159: preferred, colored
Changes since revision 1.159: +28 -10 lines
Put on my peril sensitive sunglasses and add a flags field to the internal
sysctl routines and state.  Add some code to use it for signalling the need
to downconvert a data structure to 32 bits on a 64 bit OS when requested by
a 32 bit app.

I tried to do this in a generic abi wrapper that intercepted the sysctl
oid's, or looked up the format string etc, but it was a real can of worms
that turned into a fragile mess before I even got it partially working.

With this, we can now run 'sysctl -a' on a 32 bit sysctl binary and have
it not abort.  Things like netstat, ps, etc have a long way to go.

This also fixes a bug in the kern.ps_strings and kern.usrstack hacks.
These do matter very much because they are used by libc_r and other things.

Revision 1.159: download - view: text, markup, annotated - select for diffs
Wed Jul 28 06:42:41 2004 UTC (7 years, 6 months ago) by kan
Branches: MAIN
CVS tags: RELENG_5_BP, RELENG_5_3_BP, RELENG_5_3_0_RELEASE, RELENG_5_3
Branch point for: RELENG_5
Diff to: previous 1.158: preferred, colored
Changes since revision 1.158: +3 -3 lines
Avoid casts as lvalues.

Revision 1.158: download - view: text, markup, annotated - select for diffs
Mon Jul 26 07:24:03 2004 UTC (7 years, 6 months ago) by cperciva
Branches: MAIN
Diff to: previous 1.157: preferred, colored
Changes since revision 1.157: +1 -1 lines
Rename suser_cred()'s PRISON_ROOT flag to SUSER_ALLOWJAIL.  This is
somewhat clearer, but more importantly allows for a consistent naming
scheme for suser_cred flags.

The old name is still defined, but will be removed in a few days (unless I
hear any complaints...)

Discussed with:	rwatson, scottl
Requested by:	jhb

Revision 1.157: download - view: text, markup, annotated - select for diffs
Fri Jun 11 02:20:37 2004 UTC (7 years, 8 months ago) by green
Branches: MAIN
Diff to: previous 1.156: preferred, colored
Changes since revision 1.156: +5 -2 lines
Make sysctl_wire_old_buffer() respect ENOMEM from vslock() by marking
the valid length as 0.  This prevents vsunlock() from removing a system
wire from memory that was not successfully wired (by us).

Submitted by:	tegge

Revision 1.156: download - view: text, markup, annotated - select for diffs
Mon Apr 5 21:03:35 2004 UTC (7 years, 10 months ago) by imp
Branches: MAIN
Diff to: previous 1.155: preferred, colored
Changes since revision 1.155: +0 -4 lines
Remove advertising clause from University of California Regent's license,
per letter dated July 22, 1999.

Approved by: core

Revision 1.155: download - view: text, markup, annotated - select for diffs
Tue Mar 16 06:53:03 2004 UTC (7 years, 10 months ago) by truckman
Branches: MAIN
Diff to: previous 1.154: preferred, colored
Changes since revision 1.154: +16 -14 lines
Rename the wiredlen member of struct sysctl_req to validlen and always
set it to avoid the need for a bunch of code that tests whether or
not the lock member is set to REQ_WIRED in order to determine which
length member should be used.

Fix another bug in the oldlen return value code.

Fix a potential wired memory leak if a sysctl handler uses
sysctl_wire_old_buffer() and returns an EAGAIN error to trigger
a retry.

Revision 1.154: download - view: text, markup, annotated - select for diffs
Tue Mar 16 01:28:45 2004 UTC (7 years, 10 months ago) by truckman
Branches: MAIN
Diff to: previous 1.153: preferred, colored
Changes since revision 1.153: +9 -7 lines
Don't bother calling vslock() and vsunlock() if oldlen is zero.

If vslock() returns ENOMEM, sysctl_wire_old_buffer() should set
wiredlen to zero and return zero (success) so that the handler will
operate according to sysctl(3):
     The size of the buffer is given by the location specified by
     oldlenp before the call, and that location gives the amount
     of data copied after a successful call and after a call that
     returns with the error code ENOMEM.
The handler will return an ENOMEM error because the zero length
buffer will overflow.

Revision 1.153: download - view: text, markup, annotated - select for diffs
Mon Mar 15 06:42:40 2004 UTC (7 years, 10 months ago) by truckman
Branches: MAIN
Diff to: previous 1.152: preferred, colored
Changes since revision 1.152: +3 -6 lines
Revert to the original vslock() and vsunlock() API with the following
exceptions:
	Retain the recently added vslock() error return.

	The type of the len argument should be size_t, not u_int.

Suggested by:	bde

Revision 1.152: download - view: text, markup, annotated - select for diffs
Fri Mar 5 22:03:11 2004 UTC (7 years, 11 months ago) by truckman
Branches: MAIN
Diff to: previous 1.151: preferred, colored
Changes since revision 1.151: +3 -3 lines
Undo the merger of mlock()/vslock and munlock()/vsunlock() and the
introduction of kern_mlock() and kern_munlock() in
        src/sys/kern/kern_sysctl.c      1.150
        src/sys/vm/vm_extern.h          1.69
        src/sys/vm/vm_glue.c            1.190
        src/sys/vm/vm_mmap.c            1.179
because different resource limits are appropriate for transient and
"permanent" page wiring requests.

Retain the kern_mlock() and kern_munlock() API in the revived
vslock() and vsunlock() functions.

Combine the best parts of each of the original sets of implementations
with further code cleanup.  Make the mclock() and vslock()
implementations as similar as possible.

Retain the RLIMIT_MEMLOCK check in mlock().  Move the most strigent
test, which can return EAGAIN, last so that requests that have no
hope of ever being satisfied will not be retried unnecessarily.

Disable the test that can return EAGAIN in the vslock() implementation
because it will cause the sysctl code to wedge.

Tested by:	Cy Schubert <Cy.Schubert AT komquats.com>

Revision 1.151: download - view: text, markup, annotated - select for diffs
Fri Feb 27 17:13:23 2004 UTC (7 years, 11 months ago) by des
Branches: MAIN
Diff to: previous 1.150: preferred, colored
Changes since revision 1.150: +20 -0 lines
Add sysctl_move_oid() which reparents an existing OID.

Revision 1.150: download - view: text, markup, annotated - select for diffs
Thu Feb 26 00:27:02 2004 UTC (7 years, 11 months ago) by truckman
Branches: MAIN
Diff to: previous 1.149: preferred, colored
Changes since revision 1.149: +32 -19 lines
Split the mlock() kernel code into two parts, mlock(), which unpacks
the syscall arguments and does the suser() permission check, and
kern_mlock(), which does the resource limit checking and calls
vm_map_wire().  Split munlock() in a similar way.

Enable the RLIMIT_MEMLOCK checking code in kern_mlock().

Replace calls to vslock() and vsunlock() in the sysctl code with
calls to kern_mlock() and kern_munlock() so that the sysctl code
will obey the wired memory limits.

Nuke the vslock() and vsunlock() implementations, which are no
longer used.

Add a member to struct sysctl_req to track the amount of memory
that is wired to handle the request.

Modify sysctl_wire_old_buffer() to return an error if its call to
kern_mlock() fails.  Only wire the minimum of the length specified
in the sysctl request and the length specified in its argument list.
It is recommended that sysctl handlers that use sysctl_wire_old_buffer()
should specify reasonable estimates for the amount of data they
want to return so that only the minimum amount of memory is wired
no matter what length has been specified by the request.

Modify the callers of sysctl_wire_old_buffer() to look for the
error return.

Modify sysctl_old_user to obey the wired buffer length and clean up
its implementation.

Reviewed by:	bms

Revision 1.149: download - view: text, markup, annotated - select for diffs
Sun Feb 22 12:31:43 2004 UTC (7 years, 11 months ago) by pjd
Branches: MAIN
Diff to: previous 1.148: preferred, colored
Changes since revision 1.148: +15 -15 lines
Reimplement sysctls handling by MAC framework.
Now I believe it is done in the right way.

Removed some XXMAC cases, we now assume 'high' integrity level for all
sysctls, except those with CTLFLAG_ANYBODY flag set. No more magic.

Reviewed by:	rwatson
Approved by:	rwatson, scottl (mentor)
Tested with:	LINT (compilation), mac_biba(4) (functionality)

Revision 1.148: download - view: text, markup, annotated - select for diffs
Sun Oct 5 13:31:33 2003 UTC (8 years, 4 months ago) by bms
Branches: MAIN
CVS tags: RELENG_5_2_BP, RELENG_5_2_1_RELEASE, RELENG_5_2_0_RELEASE, RELENG_5_2
Diff to: previous 1.147: preferred, colored
Changes since revision 1.147: +13 -13 lines
Bring back sysctl_wire_old_buffer(). Fix a bug in sysctl_handle_opaque()
whereby the pointers would not get reset on a retried SYSCTL_OUT() call.

Noticed by:	bde

Revision 1.147: download - view: text, markup, annotated - select for diffs
Sun Oct 5 09:37:47 2003 UTC (8 years, 4 months ago) by bms
Branches: MAIN
Diff to: previous 1.146: preferred, colored
Changes since revision 1.146: +14 -18 lines
Fix a security problem in sysctl() the long way round.

Use pre-emption detection to avoid the need for wiring a userland buffer
when copying opaque data structures.

sysctl_wire_old_buffer() is now a no-op. Other consumers of this
API should use pre-emption detection to notice update collisions.

vslock() and vsunlock() should no longer be called by any code
and should be retired in subsequent commits.

Discussed with:	pete, phk
MFC after:	1 week

Revision 1.146: download - view: text, markup, annotated - select for diffs
Sun Oct 5 08:38:22 2003 UTC (8 years, 4 months ago) by bms
Branches: MAIN
Diff to: previous 1.145: preferred, colored
Changes since revision 1.145: +8 -1 lines
Fold the vslock() and vsunlock() calls in this file with #if 0's; they will
go away in due course. Involuntary pre-emption means that we can't count
on wiring of pages alone for consistency when performing a SYSCTL_OUT()
bigger than PAGE_SIZE.

Discussed with:	pete, phk

Revision 1.145: download - view: text, markup, annotated - select for diffs
Sun Oct 5 05:38:29 2003 UTC (8 years, 4 months ago) by bms
Branches: MAIN
Diff to: previous 1.144: preferred, colored
Changes since revision 1.144: +9 -8 lines
Remove magic numbers surrounding locking state in the sysctl module, and
replace them with more meaningful defines.

Revision 1.144: download - view: text, markup, annotated - select for diffs
Wed Jun 11 00:56:56 2003 UTC (8 years, 8 months ago) by obrien
Branches: MAIN
Diff to: previous 1.143: preferred, colored
Changes since revision 1.143: +3 -1 lines
Use __FBSDID().

Revision 1.143: download - view: text, markup, annotated - select for diffs
Thu May 29 21:19:18 2003 UTC (8 years, 8 months ago) by mux
Branches: MAIN
CVS tags: RELENG_5_1_BP, RELENG_5_1_0_RELEASE, RELENG_5_1
Diff to: previous 1.142: preferred, colored
Changes since revision 1.142: +24 -1 lines
When loading a module that contains a sysctl which is already compiled
in the kernel, the sysctl_register() call would fail, as expected.
However, when unloading this module again, the kernel would then panic
in sysctl_unregister().  Print a message error instead.

Submitted by:	Nicolai Petri <nicolai@catpipe.net>
Reviewed by:	imp
Approved by:	re@ (jhb)

Revision 1.92.2.9: download - view: text, markup, annotated - select for diffs
Thu May 1 22:48:09 2003 UTC (8 years, 9 months ago) by trhodes
Branches: RELENG_4
CVS tags: RELENG_4_9_BP, RELENG_4_9_0_RELEASE, RELENG_4_9, RELENG_4_11_BP, RELENG_4_11_0_RELEASE, RELENG_4_11, RELENG_4_10_BP, RELENG_4_10_0_RELEASE, RELENG_4_10
Diff to: previous 1.92.2.8: preferred, colored; branchpoint 1.92: preferred, colored; next MAIN 1.93: preferred, colored
Changes since revision 1.92.2.8: +26 -0 lines
Bring the oid description functionality (-d) into STABLE.

PR:		51201
Submitted by:	Andy Gilligan <andy@evo6.org>

Revision 1.142: download - view: text, markup, annotated - select for diffs
Tue Mar 11 20:01:51 2003 UTC (8 years, 11 months ago) by jhb
Branches: MAIN
Diff to: previous 1.141: preferred, colored
Changes since revision 1.141: +1 -1 lines
Use a shorter and less redundant name for the sysctl tree lock.

Revision 1.141: download - view: text, markup, annotated - select for diffs
Tue Mar 4 21:03:04 2003 UTC (8 years, 11 months ago) by jhb
Branches: MAIN
Diff to: previous 1.140: preferred, colored
Changes since revision 1.140: +2 -1 lines
Replace calls to WITNESS_SLEEP() and witness_list() with equivalent calls
to WITNESS_WARN().

Revision 1.140: download - view: text, markup, annotated - select for diffs
Sat Feb 22 17:58:06 2003 UTC (8 years, 11 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.139: preferred, colored
Changes since revision 1.139: +2 -1 lines
Don't panic when enumerating SYSCTL_NODE() nodes without any children
nodes.

Submitted by:	green, Hiten Pandya <hiten@unixdaemons.com>

Revision 1.139: download - view: text, markup, annotated - select for diffs
Wed Feb 19 05:47:25 2003 UTC (8 years, 11 months ago) by imp
Branches: MAIN
Diff to: previous 1.138: preferred, colored
Changes since revision 1.138: +8 -8 lines
Back out M_* changes, per decision of the TRB.

Approved by: trb

Revision 1.138: download - view: text, markup, annotated - select for diffs
Tue Jan 21 08:55:54 2003 UTC (9 years ago) by alfred
Branches: MAIN
Diff to: previous 1.137: preferred, colored
Changes since revision 1.137: +8 -8 lines
Remove M_TRYWAIT/M_WAITOK/M_WAIT.  Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.

Revision 1.137: download - view: text, markup, annotated - select for diffs
Tue Jan 14 19:35:33 2003 UTC (9 years ago) by dillon
Branches: MAIN
Diff to: previous 1.136: preferred, colored
Changes since revision 1.136: +3 -2 lines
Introduce the ability to flag a sysctl for operation at secure level 2 or 3
in addition to secure level 1.  The mask supports up to a secure level of 8
but only add defines through CTLFLAG_SECURE3 for now.

As per the missif in the log entry for 1.11 of ip_fw2.c which added the
secure flag to the IPFW sysctl's in the first place, change the secure
level requirement from 1 to 3 now that we have support for it.

Reviewed by:	imp
With Design Suggestions by:	imp

Revision 1.136: download - view: text, markup, annotated - select for diffs
Sat Jan 11 12:39:45 2003 UTC (9 years, 1 month ago) by mux
Branches: MAIN
Diff to: previous 1.135: preferred, colored
Changes since revision 1.135: +1 -1 lines
Fix kernel build.

Pointy hats to:	dillon, Hiten Pandya <hiten@unixdaemons.com>

Revision 1.135: download - view: text, markup, annotated - select for diffs
Sun Oct 27 07:12:34 2002 UTC (9 years, 3 months ago) by rwatson
Branches: MAIN
CVS tags: RELENG_5_0_BP, RELENG_5_0_0_RELEASE, RELENG_5_0
Diff to: previous 1.134: preferred, colored
Changes since revision 1.134: +11 -0 lines
Implement mac_check_system_sysctl(), a MAC Framework entry point to
permit MAC policies to augment the security protections on sysctl()
operations.  This is not really a wonderful entry point, as we
only have access to the MIB of the target sysctl entry, rather than
the more useful entry name, but this is sufficient for policies
like Biba that wish to use their notions of privilege or integrity
to prevent inappropriate sysctl modification.  Affects MAC kernels
only.  Since SYSCTL_LOCK isn't in sysctl.h, just kern_sysctl.c,
we can't assert the SYSCTL subsystem lockin the MAC Framework.

Approved by:	re
Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories

Revision 1.134: download - view: text, markup, annotated - select for diffs
Sat Oct 26 18:19:46 2002 UTC (9 years, 3 months ago) by mux
Branches: MAIN
Diff to: previous 1.133: preferred, colored
Changes since revision 1.133: +1 -1 lines
Fix a style nit.

Revision 1.133: download - view: text, markup, annotated - select for diffs
Thu Oct 17 20:03:38 2002 UTC (9 years, 3 months ago) by robert
Branches: MAIN
Diff to: previous 1.132: preferred, colored
Changes since revision 1.132: +3 -2 lines
Use strlcpy() instead of strncpy() to copy NUL terminated strings
for safety and consistency.

Revision 1.132: download - view: text, markup, annotated - select for diffs
Sat Sep 28 17:14:54 2002 UTC (9 years, 4 months ago) by phk
Branches: MAIN
Diff to: previous 1.131: preferred, colored
Changes since revision 1.131: +1 -1 lines
Be consistent about "static" functions: if the function is marked
static in its prototype, mark it static at the definition too.

Inspired by:    FlexeLint warning #512

Revision 1.92.2.8: download - view: text, markup, annotated - select for diffs
Mon Sep 9 19:27:58 2002 UTC (9 years, 5 months ago) by sam
Branches: RELENG_4
CVS tags: RELENG_4_8_BP, RELENG_4_8_0_RELEASE, RELENG_4_8, RELENG_4_7_BP, RELENG_4_7_0_RELEASE, RELENG_4_7
Diff to: previous 1.92.2.7: preferred, colored; branchpoint 1.92: preferred, colored
Changes since revision 1.92.2.7: +22 -0 lines
MFC kern_sysctlbyname needed by forthcoming CPU_ELAN changes

Reviewed by:	phk, jhb
Approved by:	re@

Revision 1.131: download - view: text, markup, annotated - select for diffs
Sat Aug 10 19:56:45 2002 UTC (9 years, 6 months ago) by mux
Branches: MAIN
Diff to: previous 1.130: preferred, colored
Changes since revision 1.130: +3 -0 lines
Introduce a new sysctl flag, CTLFLAG_SKIP, which will cause
sysctl_sysctl_next() to skip this sysctl.  The sysctl is
still available, but doesn't appear in a "sysctl -a".

This is especially useful when you want to deprecate a sysctl,
and add a warning into it to warn users that they are using
an old interface.  Without this flag, the warning would get
echoed when running "sysctl -a" (which happens at boot).

Revision 1.130: download - view: text, markup, annotated - select for diffs
Tue Aug 6 11:28:09 2002 UTC (9 years, 6 months ago) by truckman
Branches: MAIN
Diff to: previous 1.129: preferred, colored
Changes since revision 1.129: +2 -4 lines
Don't automagically call vslock() from SYSCTL_OUT().  Instead, complain
about calls to SYSCTL_OUT() made with locks held if the buffer has not
been pre-wired.  SYSCTL_OUT() should not be called while holding locks,
but if this is not possible, the buffer should be wired by calling
sysctl_wire_old_buffer() before grabbing any locks.

Revision 1.129: download - view: text, markup, annotated - select for diffs
Sun Jul 28 21:06:14 2002 UTC (9 years, 6 months ago) by truckman
Branches: MAIN
Diff to: previous 1.128: preferred, colored
Changes since revision 1.128: +45 -6 lines
Make a temporary copy of the output data in the generic sysctl handlers
so that the data is less likely to be inconsistent if SYSCTL_OUT() blocks.
If the data is large, wire the output buffer instead.

This is somewhat less than optimal, since the handler could skip the copy
if it knew that the data was static.

If the data is dynamic, we are still not guaranteed to get a consistent
copy since another processor could change the data while the copy is in
progress because the data is not locked.  This problem could be solved if
the generic handlers had the ability to grab the proper lock before the
copy and release it afterwards.

This may duplicate work done in other sysctl handlers in the kernel which
also copy the data, possibly while a lock is held, before calling they call
a generic handler to output the data.  These handlers should probably call
SYSCTL_OUT() directly.

Revision 1.128: download - view: text, markup, annotated - select for diffs
Mon Jul 22 08:25:21 2002 UTC (9 years, 6 months ago) by truckman
Branches: MAIN
Diff to: previous 1.127: preferred, colored
Changes since revision 1.127: +17 -0 lines
Provide a way for sysctl handlers to pre-wire their output buffer before
they grab a lock so that they don't block in SYSCTL_OUT() with the lock
being held.

Revision 1.127: download - view: text, markup, annotated - select for diffs
Mon Jul 15 17:28:34 2002 UTC (9 years, 6 months ago) by markm
Branches: MAIN
Diff to: previous 1.126: preferred, colored
Changes since revision 1.126: +2 -2 lines
Fix a bazillion lint and WARNS warnings. One major fix is the removal of
semicolons from the end of macros:

#define FOO() bar(a,b,c);

becomes

#define FOO() bar(a,b,c)

Thus requiring the semicolon in the invocation of FOO. This is much
cleaner syntax and more consistent with expectations when writing
function-like things in source.

With both peril-sensitive sunglasses and flame-proof undies on, tighten
up some types, and work around some warnings generated by this. There
are some _horrible_ const/non-const issues in this code.

Revision 1.126: download - view: text, markup, annotated - select for diffs
Sat Jun 29 02:00:01 2002 UTC (9 years, 7 months ago) by alfred
Branches: MAIN
Diff to: previous 1.125: preferred, colored
Changes since revision 1.125: +1 -2 lines
more caddr_t removal.

Revision 1.125: download - view: text, markup, annotated - select for diffs
Tue Apr 2 05:50:07 2002 UTC (9 years, 10 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.124: preferred, colored
Changes since revision 1.124: +10 -10 lines
Update comment regarding the locking of the sysctl tree.

Rename memlock to sysctllock, and MEMLOCK()/MEMUNLOCK() to SYSCTL_LOCK()/
SYSCTL_UNLOCK() and related changes to make the lock names make more
sense.

Submitted by:	Jonathan Mini <mini@haikugeek.com>

Revision 1.124: download - view: text, markup, annotated - select for diffs
Tue Apr 2 04:20:38 2002 UTC (9 years, 10 months ago) by alfred
Branches: MAIN
Diff to: previous 1.123: preferred, colored
Changes since revision 1.123: +11 -31 lines
Use sx locks instead of flags+tsleep locks.

Submitted by: Jonathan Mini <mini@haikugeek.com>

Revision 1.123: download - view: text, markup, annotated - select for diffs
Mon Apr 1 21:30:48 2002 UTC (9 years, 10 months ago) by jhb
Branches: MAIN
Diff to: previous 1.122: preferred, colored
Changes since revision 1.122: +2 -2 lines
Change the suser() API to take advantage of td_ucred as well as do a
general cleanup of the API.  The entire API now consists of two functions
similar to the pre-KSE API.  The suser() function takes a thread pointer
as its only argument.  The td_ucred member of this thread must be valid
so the only valid thread pointers are curthread and a few kernel threads
such as thread0.  The suser_cred() function takes a pointer to a struct
ucred as its first argument and an integer flag as its second argument.
The flag is currently only used for the PRISON_ROOT flag.

Discussed on:	smp@

Revision 1.122: download - view: text, markup, annotated - select for diffs
Fri Mar 22 14:58:27 2002 UTC (9 years, 10 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.121: preferred, colored
Changes since revision 1.121: +13 -19 lines
In sysctl, req->td is believed always to be non-NULL, so there's no need
to test req->td for NULL values and then do somewhat more bizarre things
relating to securelevel special-casing and suser checks.  Remove the
testing and conditional security checks based on req->td!=NULL, and insert
a KASSERT that td != NULL.  Callers to sysctl must always specify the
thread (be it kernel or otherwise) requesting the operation, or a
number of current sysctls will fail due to assumptions that the thread
exists.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, NAI Labs
Discussed with:	bde

Revision 1.92.2.7: download - view: text, markup, annotated - select for diffs
Wed Mar 6 05:43:51 2002 UTC (9 years, 11 months ago) by obrien
Branches: RELENG_4
CVS tags: RELENG_4_6_BP, RELENG_4_6_2_RELEASE, RELENG_4_6_1_RELEASE, RELENG_4_6_0_RELEASE, RELENG_4_6
Diff to: previous 1.92.2.6: preferred, colored; branchpoint 1.92: preferred, colored
Changes since revision 1.92.2.6: +3 -0 lines
Add more blank lines to generate traffic on -hackers.

Revision 1.121: download - view: text, markup, annotated - select for diffs
Wed Feb 27 18:32:12 2002 UTC (9 years, 11 months ago) by jhb
Branches: MAIN
Diff to: previous 1.120: preferred, colored
Changes since revision 1.120: +1 -1 lines
Simple p_ucred -> td_ucred changes to start using the per-thread ucred
reference.

Revision 1.120: download - view: text, markup, annotated - select for diffs
Sun Dec 16 02:55:41 2001 UTC (10 years, 1 month ago) by luigi
Branches: MAIN
Diff to: previous 1.119: preferred, colored
Changes since revision 1.119: +27 -0 lines
Add code to export and print the description associated to sysctl
variables. Use the -d flag in sysctl(8) to see this information.

Possible extensions to sysctl:
 + report variables that do not have a description
 + given a name, report the oid it maps to.

Note to developers: have a look at your code, there are a number of
	variables which do not have a description.

Note to developers: do we want this in 4.5 ? It is a very small change
	and very useful for documentation purposes.

Suggested by: Orion Hodson

Revision 1.92.2.6: download - view: text, markup, annotated - select for diffs
Wed Nov 28 03:55:25 2001 UTC (10 years, 2 months ago) by peter
Branches: RELENG_4
CVS tags: RELENG_4_5_BP, RELENG_4_5_0_RELEASE, RELENG_4_5
Diff to: previous 1.92.2.5: preferred, colored; branchpoint 1.92: preferred, colored
Changes since revision 1.92.2.5: +6 -1 lines
MFC: 1.119: check suser before dumping the sysctl tree.

Revision 1.119: download - view: text, markup, annotated - select for diffs
Wed Nov 28 03:11:16 2001 UTC (10 years, 2 months ago) by peter
Branches: MAIN
Diff to: previous 1.118: preferred, colored
Changes since revision 1.118: +5 -0 lines
Dont print the sysctl node tree unless you're root.

Found by:	jkb (Yahoo OS troublemaker)

Revision 1.118: download - view: text, markup, annotated - select for diffs
Thu Nov 8 02:13:16 2001 UTC (10 years, 3 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.117: preferred, colored
Changes since revision 1.117: +6 -6 lines
o Replace reference to 'struct proc' with 'struct thread' in 'struct
  sysctl_req', which describes in-progress sysctl requests.  This permits
  sysctl handlers to have access to the current thread, permitting work
  on implementing td->td_ucred, migration of suser() to using struct
  thread to derive the appropriate ucred, and allowing struct thread to be
  passed down to other code, such as network code where td is not currently
  available (and curproc is used).

o Note: netncp and netsmb are not updated to reflect this change, as they
  are not currently KSE-adapted.

Reviewed by:		julian
Obtained from:	TrustedBSD Project

Revision 1.117: download - view: text, markup, annotated - select for diffs
Fri Oct 12 09:16:36 2001 UTC (10 years, 4 months ago) by roam
Branches: MAIN
Diff to: previous 1.116: preferred, colored
Changes since revision 1.116: +7 -3 lines
Remove the panic when trying to register a sysctl with an oid too high.
This stops panics on unloading modules which define their own sysctl sets.

However, this also removes the protection against somebody actually
defining a static sysctl with an oid in the range of the dynamic ones,
which would break badly if there is already a dynamic sysctl with
the requested oid.

Apparently, the algorithm for removing sysctl sets needs a bit more work.
For the present, the panic I introduced only leads to Bad Things (tm).

Submitted by:	many users of -current :(
Pointy hat to:	roam (myself) for not testing rev. 1.112 enough.

Revision 1.116: download - view: text, markup, annotated - select for diffs
Wed Sep 26 19:51:25 2001 UTC (10 years, 4 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.115: preferred, colored
Changes since revision 1.115: +30 -10 lines
o Modify sysctl access control check to use securelevel_gt(), and
  clarify sysctl access control logic.

Obtained from:	TrustedBSD Project

Revision 1.115: download - view: text, markup, annotated - select for diffs
Wed Sep 12 08:37:45 2001 UTC (10 years, 5 months ago) by julian
Branches: MAIN
CVS tags: KSE_MILESTONE_2
Diff to: previous 1.114: preferred, colored
Changes since revision 1.114: +19 -19 lines
KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.

Sorry john! (your next MFC will be a doosie!)

Reviewed by: peter@freebsd.org, dillon@freebsd.org

X-MFC after:    ha ha ha ha

Revision 1.114: download - view: text, markup, annotated - select for diffs
Sat Sep 1 18:19:21 2001 UTC (10 years, 5 months ago) by dillon
Branches: MAIN
CVS tags: KSE_PRE_MILESTONE_2
Diff to: previous 1.113: preferred, colored
Changes since revision 1.113: +29 -12 lines
Giant Pushdown

clock_gettime() clock_settime() nanosleep() settimeofday()
adjtime() getitimer() setitimer() __sysctl() ogetkerninfo()
sigaction() osigaction() sigpending() osigpending() osigvec()
osigblock() osigsetmask() sigsuspend() osigsuspend() osigstack()
sigaltstack() kill() okillpg() trapsignal() nosys()

Revision 1.113: download - view: text, markup, annotated - select for diffs
Wed Aug 29 11:47:53 2001 UTC (10 years, 5 months ago) by peter
Branches: MAIN
Diff to: previous 1.112: preferred, colored
Changes since revision 1.112: +13 -11 lines
Fix the ogetkerninfo() syscall handling of sizes for
KINFO_BSDI_SYSINFO.  This supposedly fixes Netscape 3.0.4 (bsdi binary)
on -current.  (and is also applicable to RELENG_4)

PR:		25476
Submitted by:	Philipp Mergenthaler <un1i@rz.uni-karlsruhe.de>

Revision 1.112: download - view: text, markup, annotated - select for diffs
Wed Jul 25 17:21:15 2001 UTC (10 years, 6 months ago) by roam
Branches: MAIN
Diff to: previous 1.111: preferred, colored
Changes since revision 1.111: +7 -3 lines
Make dynamic sysctl entries start at 0x100, not decimal 100 - there are
static entries with oid's over 100, and defining enough dynamic entries
causes an overlap.

Move the "magic" value 0x100 into <sys/sysctl.h> where it belongs.

PR:		29131
Submitted by:	"Alexander N. Kabaev" <kabaev@mail.ru>
Reviewed by:	-arch, -audit
MFC after:	2 weeks

Revision 1.111: download - view: text, markup, annotated - select for diffs
Wed Jul 25 17:13:58 2001 UTC (10 years, 6 months ago) by roam
Branches: MAIN
Diff to: previous 1.110: preferred, colored
Changes since revision 1.110: +9 -5 lines
Style(9): function names on a separate line, max line length 80 chars.

Reviewed by:	-arch, -audit
MFC after:	2 weeks

Revision 1.110: download - view: text, markup, annotated - select for diffs
Fri Jun 22 19:54:38 2001 UTC (10 years, 7 months ago) by mjacob
Branches: MAIN
Diff to: previous 1.109: preferred, colored
Changes since revision 1.109: +3 -3 lines
int -> size_t fix

Revision 1.92.2.5: download - view: text, markup, annotated - select for diffs
Mon Jun 18 23:48:13 2001 UTC (10 years, 7 months ago) by dd
Branches: RELENG_4
CVS tags: RELENG_4_4_BP, RELENG_4_4_0_RELEASE, RELENG_4_4
Diff to: previous 1.92.2.4: preferred, colored; branchpoint 1.92: preferred, colored
Changes since revision 1.92.2.4: +3 -3 lines
MFC 1.108: allow zero-length data (useful for strings).

Revision 1.109: download - view: text, markup, annotated - select for diffs
Wed Jun 13 10:58:36 2001 UTC (10 years, 7 months ago) by peter
Branches: MAIN
Diff to: previous 1.108: preferred, colored
Changes since revision 1.108: +6 -23 lines
With this commit, I hereby pronounce gensetdefs past its use-by date.

Replace the a.out emulation of 'struct linker_set' with something
a little more flexible.  <sys/linker_set.h> now provides macros for
accessing elements and completely hides the implementation.

The linker_set.h macros have been on the back burner in various
forms since 1998 and has ideas and code from Mike Smith (SET_FOREACH()),
John Polstra (ELF clue) and myself (cleaned up API and the conversion
of the rest of the kernel to use it).

The macros declare a strongly typed set.  They return elements with the
type that you declare the set with, rather than a generic void *.

For ELF, we use the magic ld symbols (__start_<setname> and
__stop_<setname>).  Thanks to Richard Henderson <rth@redhat.com> for the
trick about how to force ld to provide them for kld's.

For a.out, we use the old linker_set struct.

NOTE: the item lists are no longer null terminated.  This is why
the code impact is high in certain areas.

The runtime linker has a new method to find the linker set
boundaries depending on which backend format is in use.

linker sets are still module/kld unfriendly and should never be used
for anything that may be modular one day.

Reviewed by:	eivind

Revision 1.108: download - view: text, markup, annotated - select for diffs
Sun Jun 3 04:58:51 2001 UTC (10 years, 8 months ago) by dd
Branches: MAIN
Diff to: previous 1.107: preferred, colored
Changes since revision 1.107: +3 -3 lines
When tring to find out if this is a request for a write in
kernel_sysctl and userland_sysctl, check for whether new is NULL, not
whether newlen is 0.  This allows one to set a string sysctl to "".

Revision 1.107: download - view: text, markup, annotated - select for diffs
Sat May 19 05:45:55 2001 UTC (10 years, 8 months ago) by jlemon
Branches: MAIN
Diff to: previous 1.106: preferred, colored
Changes since revision 1.106: +25 -2 lines
Add convenience function kernel_sysctlbyname() for kernel consumers,
so they don't have to roll their own sysctlbyname function.

Revision 1.106: download - view: text, markup, annotated - select for diffs
Thu Mar 8 01:20:43 2001 UTC (10 years, 11 months ago) by tmm
Branches: MAIN
Diff to: previous 1.105: preferred, colored
Changes since revision 1.105: +11 -5 lines
Make the SYSCTL_OUT handlers sysctl_old_user() and sysctl_old_kernel()
more robust. They would correctly return ENOMEM for the first time when
the buffer was exhausted, but subsequent calls in this case could cause
writes ouside of the buffer bounds.

Approved by:	rwatson

Revision 1.92.2.4: download - view: text, markup, annotated - select for diffs
Thu Feb 22 09:29:41 2001 UTC (10 years, 11 months ago) by jhb
Branches: RELENG_4
CVS tags: RELENG_4_3_BP, RELENG_4_3_0_RELEASE, RELENG_4_3
Diff to: previous 1.92.2.3: preferred, colored; branchpoint 1.92: preferred, colored
Changes since revision 1.92.2.3: +2 -2 lines
MFC: 1.102 kern_sysctl.c 1.88 sysctl.h

Fixes for the dynamic sysctl macros to handle dynmaically generated
names and to add a few needed 'const's.

Revision 1.105: download - view: text, markup, annotated - select for diffs
Sun Feb 4 13:12:22 2001 UTC (11 years ago) by phk
Branches: MAIN
Diff to: previous 1.104: preferred, colored
Changes since revision 1.104: +2 -2 lines
Mechanical change to use <sys/queue.h> macro API instead of
fondling implementation details.

Created with: sed(1)
Reviewed by: md5(1)

Revision 1.104: download - view: text, markup, annotated - select for diffs
Mon Jan 29 13:05:21 2001 UTC (11 years ago) by peter
Branches: MAIN
Diff to: previous 1.103: preferred, colored
Changes since revision 1.103: +1 -2 lines
Remove unused variable 'int n;'

Revision 1.103: download - view: text, markup, annotated - select for diffs
Wed Jan 24 04:35:13 2001 UTC (11 years ago) by mckusick
Branches: MAIN
Diff to: previous 1.102: preferred, colored
Changes since revision 1.102: +6 -8 lines
Never reuse AUTO_OID values.

Approved by:	Alfred Perlstein <bright@wintelcom.net>

Revision 1.102: download - view: text, markup, annotated - select for diffs
Fri Jan 5 07:00:44 2001 UTC (11 years, 1 month ago) by jhb
Branches: MAIN
Diff to: previous 1.101: preferred, colored
Changes since revision 1.101: +3 -3 lines
- For dynamic sysctl's added at runtime, don't assume that the name passed
  to the SYSCTL_ADD_FOO() macros is a constant that should be turned into
  a string via the pre-processor.  Instead, require it to be an explicit
  string so that names can be generated on the fly.
- Make some of the char * arguments to sysctl_add_oid() const to quiet
  warnings.

Revision 1.101: download - view: text, markup, annotated - select for diffs
Fri Dec 8 21:50:33 2000 UTC (11 years, 2 months ago) by dwmalone
Branches: MAIN
Diff to: previous 1.100: preferred, colored
Changes since revision 1.100: +2 -3 lines
Convert more malloc+bzero to malloc+M_ZERO.

Submitted by:	josh@zipperup.org
Submitted by:	Robert Drehmel <robd@gmx.net>

Revision 1.92.2.3: download - view: text, markup, annotated - select for diffs
Mon Sep 25 12:09:20 2000 UTC (11 years, 4 months ago) by ps
Branches: RELENG_4
CVS tags: RELENG_4_2_0_RELEASE
Diff to: previous 1.92.2.2: preferred, colored; branchpoint 1.92: preferred, colored
Changes since revision 1.92.2.2: +260 -5 lines
MFC: Dynamic sysctls.

Revision 1.92.2.2: download - view: text, markup, annotated - select for diffs
Thu Aug 3 00:09:32 2000 UTC (11 years, 6 months ago) by ps
Branches: RELENG_4
CVS tags: RELENG_4_1_1_RELEASE
Diff to: previous 1.92.2.1: preferred, colored; branchpoint 1.92: preferred, colored
Changes since revision 1.92.2.1: +12 -12 lines
MFC: Sanitize SYSCTL_HANDLER_ARGS.

Revision 1.92.2.1: download - view: text, markup, annotated - select for diffs
Wed Aug 2 22:15:08 2000 UTC (11 years, 6 months ago) by peter
Branches: RELENG_4
Diff to: previous 1.92: preferred, colored
Changes since revision 1.92: +3 -3 lines
MFC: eliminate useless (and unused) third arg to vsunlock().

Revision 1.100: download - view: text, markup, annotated - select for diffs
Fri Jul 28 22:40:04 2000 UTC (11 years, 6 months ago) by peter
Branches: MAIN
CVS tags: PRE_SMPNG
Diff to: previous 1.99: preferred, colored
Changes since revision 1.99: +14 -11 lines
Fix some style nits.
Fix(?) some compile warnings regarding const handling.

Revision 1.99: download - view: text, markup, annotated - select for diffs
Sat Jul 15 10:26:03 2000 UTC (11 years, 6 months ago) by abial
Branches: MAIN
Diff to: previous 1.98: preferred, colored
Changes since revision 1.98: +253 -1 lines
These patches implement dynamic sysctls. It's possible now to add
and remove sysctl oids at will during runtime - they don't rely on
linker sets. Also, the node oids can be referenced by more than
one kernel user, which means that it's possible to create partially
overlapping trees.

Add sysctl contexts to help programmers manage multiple dynamic
oids in convenient way.

Please see the manpages for detailed discussion, and example module
for typical use.

This work is based on ideas and code snippets coming from many
people, among them:  Arun Sharma, Jonathan Lemon, Doug Rabson,
Brian Feldman, Kelly Yancey, Poul-Henning Kamp and others. I'd like
to specially thank Brian Feldman for detailed review and style
fixes.

PR:		kern/16928
Reviewed by:	dfr, green, phk

Revision 1.98: download - view: text, markup, annotated - select for diffs
Tue Jul 4 11:25:23 2000 UTC (11 years, 7 months ago) by phk
Branches: MAIN
Diff to: previous 1.97: preferred, colored
Changes since revision 1.97: +12 -12 lines
Previous commit changing SYSCTL_HANDLER_ARGS violated KNF.

Pointed out by:	bde

Revision 1.97: download - view: text, markup, annotated - select for diffs
Mon Jul 3 09:35:10 2000 UTC (11 years, 7 months ago) by phk
Branches: MAIN
Diff to: previous 1.96: preferred, colored
Changes since revision 1.96: +12 -12 lines
Style police catches up with rev 1.26 of src/sys/sys/sysctl.h:

Sanitize SYSCTL_HANDLER_ARGS so that simplistic tools can grog our
sources:

        -sysctl_vm_zone SYSCTL_HANDLER_ARGS
        +sysctl_vm_zone (SYSCTL_HANDLER_ARGS)

Revision 1.83.2.2: download - view: text, markup, annotated - select for diffs
Fri Jun 16 09:23:32 2000 UTC (11 years, 7 months ago) by jkh
Branches: RELENG_3
CVS tags: RELENG_3_5_0_RELEASE
Diff to: previous 1.83.2.1: preferred, colored; branchpoint 1.83: preferred, colored; next MAIN 1.84: preferred, colored
Changes since revision 1.83.2.1: +10 -12 lines
MFC r1.86: small extra checks on arg values.

Revision 1.96: download - view: text, markup, annotated - select for diffs
Fri May 26 02:04:35 2000 UTC (11 years, 8 months ago) by jake
Branches: MAIN
Diff to: previous 1.95: preferred, colored
Changes since revision 1.95: +2 -2 lines
Back out the previous change to the queue(3) interface.
It was not discussed and should probably not happen.

Requested by:		msmith and others

Revision 1.95: download - view: text, markup, annotated - select for diffs
Tue May 23 20:37:16 2000 UTC (11 years, 8 months ago) by jake
Branches: MAIN
Diff to: previous 1.94: preferred, colored
Changes since revision 1.94: +2 -2 lines
Change the way that the queue(3) structures are declared; don't assume that
the type argument to *_HEAD and *_ENTRY is a struct.

Suggested by:	phk
Reviewed by:	phk
Approved by:	mdodd

Revision 1.94: download - view: text, markup, annotated - select for diffs
Tue Apr 18 15:15:19 2000 UTC (11 years, 9 months ago) by phk
Branches: MAIN
Diff to: previous 1.93: preferred, colored
Changes since revision 1.93: +1 -2 lines
Remove unneeded <sys/buf.h> includes.

Due to some interesting cpp tricks in lockmgr, the LINT kernel shrinks
by 924 bytes.

Revision 1.93: download - view: text, markup, annotated - select for diffs
Mon Mar 13 10:46:34 2000 UTC (11 years, 11 months ago) by phk
Branches: MAIN
Diff to: previous 1.92: preferred, colored
Changes since revision 1.92: +3 -3 lines
Remove unused 3rd argument from vsunlock() which abused B_WRITE.

Revision 1.92: download - view: text, markup, annotated - select for diffs
Wed Dec 1 02:25:10 1999 UTC (12 years, 2 months ago) by green
Branches: MAIN
CVS tags: RELENG_4_BP, RELENG_4_1_0_RELEASE, RELENG_4_0_0_RELEASE
Branch point for: RELENG_4
Diff to: previous 1.91: preferred, colored
Changes since revision 1.91: +66 -69 lines
Separate some common sysctl code into sysctl_find_oid() and calling
thereof.  Also, make the errno returns  _correct_, and add a new one
which is more appropriate.

Revision 1.91: download - view: text, markup, annotated - select for diffs
Sat Oct 30 06:31:50 1999 UTC (12 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.90: preferred, colored
Changes since revision 1.90: +3 -3 lines
Change useracc() and kernacc() to use VM_PROT_{READ|WRITE|EXECUTE} for the
"rw" argument, rather than hijacking B_{READ|WRITE}.

Fix two bugs (physio & cam) resulting by the confusion caused by this.

Submitted by:   Tor.Egge@fast.no
Reviewed by:    alc, ken (partly)

Revision 1.25.4.9: download - view: text, markup, annotated - select for diffs
Sun Sep 5 08:32:18 1999 UTC (12 years, 5 months ago) by peter
Branches: RELENG_2_1_0
Diff to: previous 1.25.4.8: preferred, colored; branchpoint 1.25: preferred, colored; next MAIN 1.26: preferred, colored
Changes since revision 1.25.4.8: +1 -1 lines
$Id$ -> $FreeBSD$

Revision 1.66.2.2: download - view: text, markup, annotated - select for diffs
Sun Sep 5 08:15:06 1999 UTC (12 years, 5 months ago) by peter
Branches: RELENG_2_2
Diff to: previous 1.66.2.1: preferred, colored; branchpoint 1.66: preferred, colored; next MAIN 1.67: preferred, colored
Changes since revision 1.66.2.1: +1 -1 lines
$Id$ -> $FreeBSD$

Revision 1.83.2.1: download - view: text, markup, annotated - select for diffs
Sun Aug 29 16:26:03 1999 UTC (12 years, 5 months ago) by peter
Branches: RELENG_3
CVS tags: RELENG_3_4_0_RELEASE, RELENG_3_3_0_RELEASE
Diff to: previous 1.83: preferred, colored
Changes since revision 1.83: +1 -1 lines
$Id$ -> $FreeBSD$

Revision 1.90: download - view: text, markup, annotated - select for diffs
Sat Aug 28 00:46:15 1999 UTC (12 years, 5 months ago) by peter
Branches: MAIN
Diff to: previous 1.89: preferred, colored
Changes since revision 1.89: +1 -1 lines
$Id$ -> $FreeBSD$

Revision 1.89: download - view: text, markup, annotated - select for diffs
Sun Jun 27 11:44:13 1999 UTC (12 years, 7 months ago) by peter
Branches: MAIN
Diff to: previous 1.88: preferred, colored
Changes since revision 1.88: +3 -3 lines
Minor tweaks to make sure (new) prerequisites for <sys/buf.h> (mostly
splbio()/splx()) are #included in time.

Revision 1.88: download - view: text, markup, annotated - select for diffs
Wed Apr 28 11:37:00 1999 UTC (12 years, 9 months ago) by phk
Branches: MAIN
CVS tags: PRE_VFS_BIO_NFS_PATCH, POST_VFS_BIO_NFS_PATCH
Diff to: previous 1.87: preferred, colored
Changes since revision 1.87: +3 -2 lines
This Implements the mumbled about "Jail" feature.

This is a seriously beefed up chroot kind of thing.  The process
is jailed along the same lines as a chroot does it, but with
additional tough restrictions imposed on what the superuser can do.

For all I know, it is safe to hand over the root bit inside a
prison to the customer living in that prison, this is what
it was developed for in fact:  "real virtual servers".

Each prison has an ip number associated with it, which all IP
communications will be coerced to use and each prison has its own
hostname.

Needless to say, you need more RAM this way, but the advantage is
that each customer can run their own particular version of apache
and not stomp on the toes of their neighbors.

It generally does what one would expect, but setting up a jail
still takes a little knowledge.

A few notes:

   I have no scripts for setting up a jail, don't ask me for them.

   The IP number should be an alias on one of the interfaces.

   mount a /proc in each jail, it will make ps more useable.

   /proc/<pid>/status tells the hostname of the prison for
   jailed processes.

   Quotas are only sensible if you have a mountpoint per prison.

   There are no privisions for stopping resource-hogging.

   Some "#ifdef INET" and similar may be missing (send patches!)

If somebody wants to take it from here and develop it into
more of a "virtual machine" they should be most welcome!

Tools, comments, patches & documentation most welcome.

Have fun...

Sponsored by:   http://www.rndassociates.com/
Run for almost a year by:       http://www.servetheweb.com/

Revision 1.87: download - view: text, markup, annotated - select for diffs
Tue Apr 27 11:16:05 1999 UTC (12 years, 9 months ago) by phk
Branches: MAIN
CVS tags: PRE_SMP_VMSHARE, POST_SMP_VMSHARE
Diff to: previous 1.86: preferred, colored
Changes since revision 1.86: +2 -2 lines
Suser() simplification:

1:
  s/suser/suser_xxx/

2:
  Add new function: suser(struct proc *), prototyped in <sys/proc.h>.

3:
  s/suser_xxx(\([a-zA-Z0-9_]*\)->p_ucred, \&\1->p_acflag)/suser(\1)/

The remaining suser_xxx() calls will be scrutinized and dealt with
later.

There may be some unneeded #include <sys/cred.h>, but they are left
as an exercise for Bruce.

More changes to the suser() API will come along with the "jail" code.

Revision 1.86: download - view: text, markup, annotated - select for diffs
Tue Mar 30 09:00:45 1999 UTC (12 years, 10 months ago) by phk
Branches: MAIN
CVS tags: PRE_NEWBUS, POST_NEWBUS
Diff to: previous 1.85: preferred, colored
Changes since revision 1.85: +10 -12 lines
Purging lint from the Bruce filter.

Revision 1.85: download - view: text, markup, annotated - select for diffs
Tue Mar 23 14:23:15 1999 UTC (12 years, 10 months ago) by phk
Branches: MAIN
Diff to: previous 1.84: preferred, colored
Changes since revision 1.84: +6 -4 lines
Fix some nasty hangs if garbage were passed.

Noticed by:	Emmanuel DELOGET <pixel@DotCom.FR>
Remembered by:	msmith

Revision 1.84: download - view: text, markup, annotated - select for diffs
Tue Feb 16 10:49:48 1999 UTC (12 years, 11 months ago) by dfr
Branches: MAIN
Diff to: previous 1.83: preferred, colored
Changes since revision 1.83: +157 -174 lines
* Change sysctl from using linker_set to construct its tree using SLISTs.
  This makes it possible to change the sysctl tree at runtime.

* Change KLD to find and register any sysctl nodes contained in the loaded
  file and to unregister them when the file is unloaded.

Reviewed by: Archie Cobbs <archie@whistle.com>,
	Peter Wemm <peter@netplex.com.au> (well they looked at it anyway)

Revision 1.83: download - view: text, markup, annotated - select for diffs
Sun Jan 10 07:45:31 1999 UTC (13 years, 1 month ago) by phk
Branches: MAIN
CVS tags: RELENG_3_BP, RELENG_3_2_PAO_BP, RELENG_3_2_PAO, RELENG_3_2_0_RELEASE, RELENG_3_1_0_RELEASE
Branch point for: RELENG_3
Diff to: previous 1.82: preferred, colored
Changes since revision 1.82: +2 -47 lines
Back out last change to sysctl.

It was nay'ed before committing on the grounds that this is not
the way to do it, and has been decided as such several times in
the past.

There is not point in loading gobs of ascii into the kernel when
the only use of that ascii is presentation to the user.

Next thing we'd be adding all section 4 man pages to the loaded
kernel as well.

The argument about KLD's is bogus, klds can store a file in
/usr/share/doc/sysctl/dev/foo/thisvar.txt with a description and
sysctl or other facilities can pick it up there.

Proper documentation will take several K worth of text for many
sysctl variables, we don't want that in the kernel under any
circumstances.

I will welcome any well thought out attempt at improving the
situation wrt. sysctl documentation, but this wasn't it.

Revision 1.82: download - view: text, markup, annotated - select for diffs
Sun Jan 10 05:33:42 1999 UTC (13 years, 1 month ago) by des
Branches: MAIN
Diff to: previous 1.81: preferred, colored
Changes since revision 1.81: +48 -3 lines
Add kernel support for sysctl descriptions. The NO_SYSCTL_DESCRIPTIONS option
disables them if they're not wanted; in that case, sysctl_sysctl_descr will
always return an empty string.

Apporved by:	jkh

Revision 1.81: download - view: text, markup, annotated - select for diffs
Sun Dec 27 18:03:29 1998 UTC (13 years, 1 month ago) by dfr
Branches: MAIN
Diff to: previous 1.80: preferred, colored
Changes since revision 1.80: +4 -34 lines
Fix some 64bit truncation problems which crept into SYSCTL_LONG() with the
last cleanup.  Since the oid_arg2 field of struct sysctl_oid is not wide
enough to hold a long, the SYSCTL_LONG() macro has been modified to only
support exporting long variables by pointer instead of by value.

Reviewed by: bde

Revision 1.80: download - view: text, markup, annotated - select for diffs
Sun Dec 13 07:18:54 1998 UTC (13 years, 2 months ago) by truckman
Branches: MAIN
Diff to: previous 1.79: preferred, colored
Changes since revision 1.79: +3 -2 lines
Add a generic flag, CTLFLAG_SECURE, which can be used to mark a sysctl
variable unwriteable when securelevel > 0.
Reviewed by: jdp, eivind

Revision 1.79: download - view: text, markup, annotated - select for diffs
Fri Dec 4 22:54:51 1998 UTC (13 years, 2 months ago) by archie
Branches: MAIN
Diff to: previous 1.78: preferred, colored
Changes since revision 1.78: +2 -2 lines
Examine all occurrences of sprintf(), strcat(), and str[n]cpy()
for possible buffer overflow problems. Replaced most sprintf()'s
with snprintf(); for others cases, added terminating NUL bytes where
appropriate, replaced constants like "16" with sizeof(), etc.

These changes include several bug fixes, but most changes are for
maintainability's sake. Any instance where it wasn't "immediately
obvious" that a buffer overflow could not occur was made safer.

Reviewed by:	Bruce Evans <bde@zeta.org.au>
Reviewed by:	Matthew Dillon <dillon@apollo.backplane.com>
Reviewed by:	Mike Spengler <mks@networkcs.com>

Revision 1.78: download - view: text, markup, annotated - select for diffs
Fri Oct 16 03:55:00 1998 UTC (13 years, 3 months ago) by peter
Branches: MAIN
CVS tags: RELENG_3_0_0_RELEASE
Diff to: previous 1.77: preferred, colored
Changes since revision 1.77: +3 -1 lines
*gulp*.  Jordan specifically OK'ed this..

This is the bulk of the support for doing kld modules.  Two linker_sets
were replaced by SYSINIT()'s.  VFS's and exec handlers are self registered.
kld is now a superset of lkm.  I have converted most of them, they will
follow as a seperate commit as samples.
This all still works as a static a.out kernel using LKM's.

Revision 1.77: download - view: text, markup, annotated - select for diffs
Sat Sep 5 17:13:27 1998 UTC (13 years, 5 months ago) by bde
Branches: MAIN
Diff to: previous 1.76: preferred, colored
Changes since revision 1.76: +10 -2 lines
Ignore the statically configured vfs type numbers and assign vfs
type numbers in vfs attach order (modulo incomplete reuse of old
numbers after vfs LKMs are unloaded).  This requires reinitializing
the sysctl tree (or at least the vfs subtree) for vfs's that support
sysctls (currently only nfs).  sysctl_order() already handled
reinitialization reasonably except it checked for annulled self
references in the wrong place.

Fixed sysctls for vfs LKMs.

Revision 1.76: download - view: text, markup, annotated - select for diffs
Sat Sep 5 14:30:10 1998 UTC (13 years, 5 months ago) by bde
Branches: MAIN
Diff to: previous 1.75: preferred, colored
Changes since revision 1.75: +2 -2 lines
Fixed bogotification of pseudocode for syscall args by rev.1.53 of
syscalls.master.

Revision 1.75: download - view: text, markup, annotated - select for diffs
Mon Aug 24 08:39:38 1998 UTC (13 years, 5 months ago) by dfr
Branches: MAIN
Diff to: previous 1.74: preferred, colored
Changes since revision 1.74: +73 -13 lines
Change various syscalls to use size_t arguments instead of u_int.

Add some overflow checks to read/write (from bde).

Change all modifications to vm_page::flags, vm_page::busy, vm_object::flags
and vm_object::paging_in_progress to use operations which are not
interruptable.

Reviewed by: Bruce Evans <bde@zeta.org.au>

Revision 1.74: download - view: text, markup, annotated - select for diffs
Tue Dec 16 17:40:20 1997 UTC (14 years, 1 month ago) by eivind
Branches: MAIN
CVS tags: PRE_SOFTUPDATE, PRE_NOBDEV, PRE_DEVFS_SLICE, POST_SOFTUPDATE, POST_DEVFS_SLICE
Diff to: previous 1.73: preferred, colored
Changes since revision 1.73: +3 -1 lines
Make COMPAT_43 and COMPAT_SUNOS new-style options.

Revision 1.73: download - view: text, markup, annotated - select for diffs
Thu Nov 6 19:29:15 1997 UTC (14 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.72: preferred, colored
Changes since revision 1.72: +4 -4 lines
Move the "retval" (3rd) parameter from all syscall functions and put
it in struct proc instead.

This fixes a boatload of compiler warning, and removes a lot of cruft
from the sources.

I have not removed the /*ARGSUSED*/, they will require some looking at.

libkvm, ps and other userland struct proc frobbing programs will need
recompiled.

Revision 1.72: download - view: text, markup, annotated - select for diffs
Sun Oct 12 20:23:56 1997 UTC (14 years, 4 months ago) by phk
Branches: MAIN
Diff to: previous 1.71: preferred, colored
Changes since revision 1.71: +2 -2 lines
Last major round (Unless Bruce thinks of somthing :-) of malloc changes.

Distribute all but the most fundamental malloc types.  This time I also
remembered the trick to making things static:  Put "static" in front of
them.

A couple of finer points by:	bde

Revision 1.71: download - view: text, markup, annotated - select for diffs
Sat Oct 11 18:31:24 1997 UTC (14 years, 4 months ago) by phk
Branches: MAIN
Diff to: previous 1.70: preferred, colored
Changes since revision 1.70: +3 -1 lines
Distribute and statizice a lot of the malloc M_* types.

Substantial input from:	bde

Revision 1.25.4.8: download - view: text, markup, annotated - select for diffs
Sun Aug 17 15:20:32 1997 UTC (14 years, 5 months ago) by joerg
Branches: RELENG_2_1_0
Diff to: previous 1.25.4.7: preferred, colored; branchpoint 1.25: preferred, colored
Changes since revision 1.25.4.7: +2 -2 lines
Sorta MFC.  Don't allow PID 1 to compromise our securelevel.  Equivalent
to rev 1.9 of the now kern_mib.c.

Revision 1.70: download - view: text, markup, annotated - select for diffs
Wed Apr 9 15:23:09 1997 UTC (14 years, 10 months ago) by bde
Branches: MAIN
CVS tags: pre_smp_merge, post_smp_merge, WOLLMAN_MBUF, BP_WOLLMAN_MBUF
Diff to: previous 1.69: preferred, colored
Changes since revision 1.69: +2 -2 lines
Include <sys/buf.h> instead of <sys/vnode.h>.  kern_sysctl.c no
longer has anything to do with vnodes and never had anything to do
with buffers, but it needs the definitions of B_READ and B_WRITE
for use with the bogus useracc() interface and was getting them
bogusly due to excessive cleanups in rev.1.49.

Revision 1.69: download - view: text, markup, annotated - select for diffs
Sat Feb 22 09:39:12 1997 UTC (14 years, 11 months ago) by peter
Branches: MAIN
Diff to: previous 1.68: preferred, colored
Changes since revision 1.68: +1 -1 lines
Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$.  We are not
ready for it yet.

Revision 1.68: download - view: text, markup, annotated - select for diffs
Tue Jan 14 06:43:42 1997 UTC (15 years ago) by jkh
Branches: MAIN
Diff to: previous 1.67: preferred, colored
Changes since revision 1.67: +1 -1 lines
Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.

Revision 1.66.2.1: download - view: text, markup, annotated - select for diffs
Wed Dec 18 11:45:41 1996 UTC (15 years, 1 month ago) by bde
Branches: RELENG_2_2
CVS tags: RELENG_2_2_8_RELEASE, RELENG_2_2_7_RELEASE, RELENG_2_2_6_RELEASE, RELENG_2_2_5_RELEASE, RELENG_2_2_2_RELEASE, RELENG_2_2_1_RELEASE, RELENG_2_2_0_RELEASE
Diff to: previous 1.66: preferred, colored
Changes since revision 1.66: +2 -2 lines
YAMFC (fixed garbage being returned for constant int values.  The log
message for rev.1.67 neglected to say that there is only a problem for
values of 0).

Revision 1.67: download - view: text, markup, annotated - select for diffs
Sun Dec 15 14:38:46 1996 UTC (15 years, 1 month ago) by bde
Branches: MAIN
Diff to: previous 1.66: preferred, colored
Changes since revision 1.66: +2 -2 lines
Fixed garbage being returned for constant int values, e.g., for
KERN_SAVED_IDS.

Should be in 2.2.

Reviewed by:	phk
Found by:	NIST-PCTS

Revision 1.25.4.7: download - view: text, markup, annotated - select for diffs
Thu Sep 19 08:18:03 1996 UTC (15 years, 4 months ago) by pst
Branches: RELENG_2_1_0
CVS tags: RELENG_2_1_7_RELEASE, RELENG_2_1_6_RELEASE, RELENG_2_1_6_1_RELEASE
Diff to: previous 1.25.4.6: preferred, colored; branchpoint 1.25: preferred, colored
Changes since revision 1.25.4.6: +4 -1 lines
Bring in the new sysctl variables and TCP timer patches from head

Revision 1.66: download - view: text, markup, annotated - select for diffs
Tue Sep 3 22:26:31 1996 UTC (15 years, 5 months ago) by bde
Branches: MAIN
CVS tags: RELENG_2_2_BP
Branch point for: RELENG_2_2
Diff to: previous 1.65: preferred, colored
Changes since revision 1.65: +5 -4 lines
Fixed bogus casts (const on the wrong `*' in `**') in a qsort-comparision
function.

Revision 1.65: download - view: text, markup, annotated - select for diffs
Sat Aug 31 14:47:55 1996 UTC (15 years, 5 months ago) by bde
Branches: MAIN
Diff to: previous 1.64: preferred, colored
Changes since revision 1.64: +6 -5 lines
Don't depend in the kernel on the gcc feature of doing arithmetic on
pointers of type `void *'.  Warn about this in future.

Revision 1.64: download - view: text, markup, annotated - select for diffs
Mon Jun 10 16:23:30 1996 UTC (15 years, 8 months ago) by nate
Branches: MAIN
Diff to: previous 1.63: preferred, colored
Changes since revision 1.63: +63 -5 lines
Implemented 'kern_sysctl', which differs from 'userland_sysctl' in that
it assumes all of the data exists in the kernel.  Also, fix
sysctl_new-kernel (unused until now) which had reversed operands to
bcopy().

Reviewed by:	phk

Poul writes:
... actually the lock/sleep/wakeup cruft shouldn't be needed in the
kernel version I think, but just leave it there for now.

Revision 1.63: download - view: text, markup, annotated - select for diffs
Thu Jun 6 17:17:54 1996 UTC (15 years, 8 months ago) by phk
Branches: MAIN
Diff to: previous 1.62: preferred, colored
Changes since revision 1.62: +7 -3 lines
If handler function returns EAGAIN, restart operation.

Revision 1.25.4.6: download - view: text, markup, annotated - select for diffs
Tue Jun 4 02:46:09 1996 UTC (15 years, 8 months ago) by davidg
Branches: RELENG_2_1_0
CVS tags: RELENG_2_1_5_RELEASE
Diff to: previous 1.25.4.5: preferred, colored; branchpoint 1.25: preferred, colored
Changes since revision 1.25.4.5: +34 -5 lines
Implemented zpfind() which returns the struct proc * of a zombie PID.
Used the above as part of a fix for an architectural flaw in the way that
sysctl_doproc works. sysctl_doproc can block while traversing the proc
lists and the state of the list may have changed during this time. The
fix is to check that the process still exists, and if not, restart the
loop from the beginning.

Note that I don't understand how to unwind SYSCTL_OUT things in -current,
SO SOMEBODY ELSE WILL HAVE TO IMPLEMENT THIS FIX THERE!!! (Poul?)

Revision 1.25.4.5: download - view: text, markup, annotated - select for diffs
Fri May 31 08:04:10 1996 UTC (15 years, 8 months ago) by peter
Branches: RELENG_2_1_0
Diff to: previous 1.25.4.4: preferred, colored; branchpoint 1.25: preferred, colored
Changes since revision 1.25.4.4: +23 -2 lines
Add sysctl hooks for user-mode setproctitle() and libkvm to see,
taken from -current, but implemented in old-style sysctl.

Revision 1.25.4.4: download - view: text, markup, annotated - select for diffs
Thu May 30 01:24:41 1996 UTC (15 years, 8 months ago) by davidg
Branches: RELENG_2_1_0
Diff to: previous 1.25.4.3: preferred, colored; branchpoint 1.25: preferred, colored
Changes since revision 1.25.4.3: +10 -8 lines
Brought in fixes from current: fix for panic caused by dereferencing
(proc)->p_session of an exiting process. This problem manifested itself
via a panic in fill_eproc() when running "top".

Revision 1.62: download - view: text, markup, annotated - select for diffs
Sat Apr 13 13:28:54 1996 UTC (15 years, 10 months ago) by phk
Branches: MAIN
Diff to: previous 1.61: preferred, colored
Changes since revision 1.61: +18 -23 lines
Fix a longstanding bug and a buglet of no significance.
Now net.ipx works.

Noticed by:	John Hay -- John.Hay@csir.co.za

Revision 1.61: download - view: text, markup, annotated - select for diffs
Sun Apr 7 13:03:06 1996 UTC (15 years, 10 months ago) by phk
Branches: MAIN
Diff to: previous 1.60: preferred, colored
Changes since revision 1.60: +6 -136 lines
Move the "mib" variables out to their own file.

Revision 1.1.1.2 (vendor branch): download - view: text, markup, annotated - select for diffs
Mon Mar 11 20:01:26 1996 UTC (15 years, 11 months ago) by peter
Branches: CSRG
CVS tags: bsd_44_lite_2
Diff to: previous 1.1.1.1: preferred, colored
Changes since revision 1.1.1.1: +73 -67 lines
Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all
files are off the vendor branch, so this should not change anything.

A "U" marker generally means that the file was not changed in between
the 4.4Lite and Lite-2 releases, and does not need a merge.  "C" generally
means that there was a change.
[note new unused (in this form) syscalls.conf, to be 'cvs rm'ed]

Revision 1.60: download - view: text, markup, annotated - select for diffs
Mon Mar 11 02:18:22 1996 UTC (15 years, 11 months ago) by hsu
Branches: MAIN
CVS tags: wollman_polling
Diff to: previous 1.59: preferred, colored
Changes since revision 1.59: +2 -2 lines
From Lite2: rename fs to vfs.
Reviewed by:	davidg & bde

Revision 1.25.4.3: download - view: text, markup, annotated - select for diffs
Thu Feb 22 19:22:30 1996 UTC (15 years, 11 months ago) by peter
Branches: RELENG_2_1_0
Diff to: previous 1.25.4.2: preferred, colored; branchpoint 1.25: preferred, colored
Changes since revision 1.25.4.2: +3 -1 lines
Fill in the eproc's e_login field before it's passed out to the user via
sysctl.  This makes 'ps -ax -O login' work.

Revision 1.59: download - view: text, markup, annotated - select for diffs
Mon Jan 1 17:05:05 1996 UTC (16 years, 1 month ago) by peter
Branches: MAIN
Diff to: previous 1.58: preferred, colored
Changes since revision 1.58: +2 -2 lines
Fix the reversed source and dest args to bcopy() in the kernel space
sysctl handler (ouch!)

Add a "const" qualifier to the source of the copyin() and copyout()
functions - the other const warning in kern_sysctl.c was silenced when
copyout was declared as having a const source.. (which it is)

Revision 1.58: download - view: text, markup, annotated - select for diffs
Sun Dec 17 21:11:22 1995 UTC (16 years, 1 month ago) by phk
Branches: MAIN
Diff to: previous 1.57: preferred, colored
Changes since revision 1.57: +11 -9 lines
Add an obscure feature, needed for debugging.

Revision 1.57: download - view: text, markup, annotated - select for diffs
Thu Dec 14 08:31:36 1995 UTC (16 years, 2 months ago) by phk
Branches: MAIN
Diff to: previous 1.56: preferred, colored
Changes since revision 1.56: +3 -3 lines
A Major staticize sweep.  Generates a couple of warnings that I'll deal
with later.
A number of unused vars removed.
A number of unused procs removed or #ifdefed.

Revision 1.56: download - view: text, markup, annotated - select for diffs
Thu Dec 7 12:46:52 1995 UTC (16 years, 2 months ago) by davidg
Branches: MAIN
Diff to: previous 1.55: preferred, colored
Changes since revision 1.55: +4 -1 lines
Untangled the vm.h include file spaghetti.

Revision 1.55: download - view: text, markup, annotated - select for diffs
Wed Dec 6 13:27:38 1995 UTC (16 years, 2 months ago) by phk
Branches: MAIN
Diff to: previous 1.54: preferred, colored
Changes since revision 1.54: +48 -12 lines
A couple of minor tweaks to the sysctl stuff.

Revision 1.54: download - view: text, markup, annotated - select for diffs
Tue Dec 5 21:51:33 1995 UTC (16 years, 2 months ago) by bde
Branches: MAIN
Diff to: previous 1.53: preferred, colored
Changes since revision 1.53: +3 -1 lines
Include <vm/vm.h> or <vm/vm_page.h> explicitly to avoid breaking when
vnode_if.h doesn't include vm stuff.

Revision 1.53: download - view: text, markup, annotated - select for diffs
Mon Dec 4 16:48:30 1995 UTC (16 years, 2 months ago) by phk
Branches: MAIN
Diff to: previous 1.52: preferred, colored
Changes since revision 1.52: +332 -80 lines
A major sweep over the sysctl stuff.

Move a lot of variables home to their own code (In good time before xmas :-)

Introduce the string descrition of format.

Add a couple more functions to poke into these marvels, while I try to
decide what the correct interface should look like.

Next is adding vars on the fly, and sysctl looking at them too.

Removed a tine bit of defunct and #ifdefed notused code in swapgeneric.

Revision 1.52: download - view: text, markup, annotated - select for diffs
Mon Nov 20 12:42:03 1995 UTC (16 years, 2 months ago) by phk
Branches: MAIN
Diff to: previous 1.51: preferred, colored
Changes since revision 1.51: +107 -366 lines
Mega commit for sysctl.
Convert the remaining sysctl stuff to the new way of doing things.
the devconf stuff is the reason for the large number of files.
Cleaned up some compiler warnings while I were there.

Revision 1.51: download - view: text, markup, annotated - select for diffs
Thu Nov 16 18:59:49 1995 UTC (16 years, 2 months ago) by phk
Branches: MAIN
Diff to: previous 1.50: preferred, colored
Changes since revision 1.50: +1 -4 lines
All net.* sysctl converted now.

Revision 1.50: download - view: text, markup, annotated - select for diffs
Tue Nov 14 20:43:29 1995 UTC (16 years, 2 months ago) by phk
Branches: MAIN
Diff to: previous 1.49: preferred, colored
Changes since revision 1.49: +2 -5 lines
 Do what is generally belived to be the right thing, though it may not be :-)

Revision 1.49: download - view: text, markup, annotated - select for diffs
Tue Nov 14 09:42:22 1995 UTC (16 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.48: preferred, colored
Changes since revision 1.48: +1 -9 lines
Final part of this bunch of sysctl commits: cleanup.

Revision 1.48: download - view: text, markup, annotated - select for diffs
Tue Nov 14 09:39:44 1995 UTC (16 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.47: preferred, colored
Changes since revision 1.47: +1 -50 lines
Get rid of the last debug sysctl variables of the old style.

Revision 1.47: download - view: text, markup, annotated - select for diffs
Tue Nov 14 09:37:22 1995 UTC (16 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.46: preferred, colored
Changes since revision 1.46: +3 -13 lines
Get rid of hostnamelen variable.

Revision 1.46: download - view: text, markup, annotated - select for diffs
Tue Nov 14 09:29:15 1995 UTC (16 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.45: preferred, colored
Changes since revision 1.45: +1 -4 lines
Move all the VM sysctl stuff home where it belongs.

Revision 1.45: download - view: text, markup, annotated - select for diffs
Tue Nov 14 09:26:17 1995 UTC (16 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.44: preferred, colored
Changes since revision 1.44: +5 -8 lines
A couple of nitpicks.

Revision 1.44: download - view: text, markup, annotated - select for diffs
Tue Nov 14 09:22:15 1995 UTC (16 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.43: preferred, colored
Changes since revision 1.43: +35 -20 lines
Convert dumpdev & securelevel.

Revision 1.43: download - view: text, markup, annotated - select for diffs
Tue Nov 14 09:17:32 1995 UTC (16 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.42: preferred, colored
Changes since revision 1.42: +1 -6 lines
KERN_MAXFILESPERPROC, KERN_MAXFILES went to another file.

Revision 1.42: download - view: text, markup, annotated - select for diffs
Tue Nov 14 09:10:54 1995 UTC (16 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.41: preferred, colored
Changes since revision 1.41: +3 -14 lines
Get rid of domainnamelen.

Revision 1.41: download - view: text, markup, annotated - select for diffs
Tue Nov 14 09:07:14 1995 UTC (16 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.40: preferred, colored
Changes since revision 1.40: +1 -4 lines
Move KERN_NTP to a more suitable file.

Revision 1.40: download - view: text, markup, annotated - select for diffs
Tue Nov 14 09:05:40 1995 UTC (16 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.39: preferred, colored
Changes since revision 1.39: +1 -213 lines
Move the process-table stuff to a more suitable file.
Remove filetable stuff from kern_sysctl.c

Revision 1.39: download - view: text, markup, annotated - select for diffs
Mon Nov 13 13:54:09 1995 UTC (16 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.38: preferred, colored
Changes since revision 1.38: +67 -48 lines
Try to make my new scheme work more along the lines of the manual.
There are still some gray areas here and there.

Revision 1.38: download - view: text, markup, annotated - select for diffs
Sun Nov 12 19:51:51 1995 UTC (16 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.37: preferred, colored
Changes since revision 1.37: +160 -113 lines
The entire sysctl callback to read/write version.  I havn't tested this as
much as I'd like to, but the malloc stunt I tried for an interim for
sure does worse.
Now we can read and write from any kind of address-space, not only
user and kernel, using callbacks.
This may be over-generalization for now, but it's actually simpler.

Revision 1.37: download - view: text, markup, annotated - select for diffs
Sun Nov 12 06:43:01 1995 UTC (16 years, 3 months ago) by bde
Branches: MAIN
Diff to: previous 1.36: preferred, colored
Changes since revision 1.36: +6 -1 lines
Included <sys/sysproto.h> to get central declarations for syscall args
structs and prototypes for syscalls.

Ifdefed duplicated decentralized declarations of args structs.  It's
convenient to have this visible but they are hard to maintain.  Some
are already different from the central declarations.  4.4lite2 puts
them in comments in the function headers but I wanted to avoid the
large changes for that.

Revision 1.36: download - view: text, markup, annotated - select for diffs
Sat Nov 11 00:09:21 1995 UTC (16 years, 3 months ago) by bde
Branches: MAIN
Diff to: previous 1.35: preferred, colored
Changes since revision 1.35: +11 -8 lines
Fixed type of sysctl_order_cmp().
KNFized sysctl_order_cmp().
Staticized definition of kern_sysctl() to match its declaration.

Revision 1.35: download - view: text, markup, annotated - select for diffs
Fri Nov 10 16:22:41 1995 UTC (16 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.34: preferred, colored
Changes since revision 1.34: +4 -3 lines
Fix a minor buglet.

Revision 1.34: download - view: text, markup, annotated - select for diffs
Fri Nov 10 09:58:53 1995 UTC (16 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.33: preferred, colored
Changes since revision 1.33: +3 -4 lines
convert more sysctl variables.

Revision 1.33: download - view: text, markup, annotated - select for diffs
Thu Nov 9 20:22:09 1995 UTC (16 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.32: preferred, colored
Changes since revision 1.32: +110 -75 lines
Make the old compat functions use the sysctl  front door, rather than
crashing through the walls.
This should save Peters blood pressure and netscapes uname call.

Revision 1.32: download - view: text, markup, annotated - select for diffs
Wed Nov 8 08:46:01 1995 UTC (16 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.31: preferred, colored
Changes since revision 1.31: +112 -22 lines
Fix some of the sysctl broke, and add a lot more to it.

Revision 1.31: download - view: text, markup, annotated - select for diffs
Mon Nov 6 16:18:52 1995 UTC (16 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.30: preferred, colored
Changes since revision 1.30: +222 -177 lines
On working the new sysctl vars a bit I realized that I needed more generality.
This is here now.  We can now access (the new) sysctl variables from the
kernel too and using functions to handle access is more sane now.
I will now attack sysctl variables in the rest of the kernel and get them
all converted to newspeak.

Revision 1.30: download - view: text, markup, annotated - select for diffs
Sat Oct 28 13:07:23 1995 UTC (16 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.29: preferred, colored
Changes since revision 1.29: +65 -112 lines
Sorry, the last commit screwed up for me, this is the right one (I hope!)
Please refer to the previous commit message about sysctl variables.

Revision 1.29: download - view: text, markup, annotated - select for diffs
Sat Oct 28 12:59:08 1995 UTC (16 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.28: preferred, colored
Changes since revision 1.28: +313 -71 lines
Rewamp the way we make sysctl variables to be easier to cope with.

The goal is to make them "user-friendly" :-)

In the end this will allow a SNMP style "getnext" function, sysctl editing
in the boot-editor and/or debugger, LKMs can define sysctl vars when
they get loaded, and remove them when unloaded and other interesting
uses for dynamic sysctl variables.

Revision 1.25.4.2: download - view: text, markup, annotated - select for diffs
Sun Aug 20 03:12:38 1995 UTC (16 years, 5 months ago) by davidg
Branches: RELENG_2_1_0
CVS tags: RELENG_2_1_0_RELEASE
Diff to: previous 1.25.4.1: preferred, colored; branchpoint 1.25: preferred, colored
Changes since revision 1.25.4.1: +136 -13 lines
Brought in changes from revs 1.26 and 1.28 (all remaining diffs from
the main branch): BSDI compatibility in ogetkerninfo and fix sysctl
to return as much info as possible.

Revision 1.28: download - view: text, markup, annotated - select for diffs
Mon Jul 31 10:07:31 1995 UTC (16 years, 6 months ago) by mpp
Branches: MAIN
Diff to: previous 1.27: preferred, colored
Changes since revision 1.27: +25 -13 lines
Fix the sysctl string routines to return as much of the
string as possible and return ENOMEM if the entire string cannot
be returned.  This brings the routines in line with how the man
page says they work, and how the calling routines are expecting
them to work.  This allows the dummy uname() routine in libc to
obtain the version string, since the kernel version string is
longer than that normally returned by the uname() routine.
This is 3/4 of the fix for PR# 462.

Reviewed by: Bruce Evans

Revision 1.25.4.1: download - view: text, markup, annotated - select for diffs
Sat Jul 29 05:14:28 1995 UTC (16 years, 6 months ago) by davidg
Branches: RELENG_2_1_0
Diff to: previous 1.25: preferred, colored
Changes since revision 1.25: +6 -5 lines
Brought in change from rev 1.27: fix panic in fill_eproc() caused by
inadequate NULL check.

Revision 1.27: download - view: text, markup, annotated - select for diffs
Fri Jul 28 18:04:47 1995 UTC (16 years, 6 months ago) by davidg
Branches: MAIN
Diff to: previous 1.26: preferred, colored
Changes since revision 1.26: +6 -5 lines
Fixed panic in fill_eproc() caused by inadequate checking for NULL pointers.

Revision 1.26: download - view: text, markup, annotated - select for diffs
Sun Jul 9 02:49:30 1995 UTC (16 years, 7 months ago) by peter
Branches: MAIN
Diff to: previous 1.25: preferred, colored
Changes since revision 1.25: +112 -1 lines
This implements enough of the BSDI extensions to the net-2 ogetkerninfo()
syscall to allow applications linked against their libc's uname() to
work.  Netscape 1.1N being a prime example, which prints:
"uname() failed. cant tell what system we're running on".
This change is a little ugly, but that's mainly because of the "interesting"
semantics of the BSDI extension.
Since ogetkerninfo() is only enabled by COMPAT_43, Netscape will only
be affected on kernels with that option (eg: "GENERIC")
Reviewed by:	davidg

Revision 1.25: download - view: text, markup, annotated - select for diffs
Tue May 30 08:05:46 1995 UTC (16 years, 8 months ago) by rgrimes
Branches: MAIN
CVS tags: RELENG_2_1_0_BP, RELENG_2_0_5_RELEASE, RELENG_2_0_5_BP, RELENG_2_0_5
Branch point for: RELENG_2_1_0
Diff to: previous 1.24: preferred, colored
Changes since revision 1.24: +4 -4 lines
Remove trailing whitespace.

Revision 1.24: download - view: text, markup, annotated - select for diffs
Fri May 12 19:17:31 1995 UTC (16 years, 9 months ago) by wollman
Branches: MAIN
CVS tags: RELENG_2_0_5_ALPHA
Diff to: previous 1.23: preferred, colored
Changes since revision 1.23: +11 -1 lines
The death of `options NODUMP'.  Now the dump area can be dynamically
configured (and unconfigured) on the fly.  A sysctl(3) MIB variable is
provided to inspect and modify the dump device setting.

Revision 1.23: download - view: text, markup, annotated - select for diffs
Thu Mar 16 18:12:37 1995 UTC (16 years, 10 months ago) by bde
Branches: MAIN
Diff to: previous 1.22: preferred, colored
Changes since revision 1.22: +1 -5 lines
Add and move declarations to fix all of the warnings from `gcc -Wimplicit'
(except in netccitt, netiso and netns) and most of the warnings from
`gcc -Wnested-externs'.  Fix all the bugs found.  There were no serious
ones.

Revision 1.22: download - view: text, markup, annotated - select for diffs
Mon Feb 20 19:42:35 1995 UTC (16 years, 11 months ago) by guido
Branches: MAIN
Diff to: previous 1.21: preferred, colored
Changes since revision 1.21: +5 -1 lines
Implement maxprocperuid and maxfilesperproc. They are tunable
via sysctl(8). The initial value of maxprocperuid is maxproc-1,
that of maxfilesperproc is maxfiles (untill maxfile will disappear)

Now it is at least possible to prohibit one user opening maxfiles

-Guido

Submitted by:
Obtained from:

Revision 1.21: download - view: text, markup, annotated - select for diffs
Wed Dec 28 06:15:08 1994 UTC (17 years, 1 month ago) by davidg
Branches: MAIN
Diff to: previous 1.20: preferred, colored
Changes since revision 1.20: +24 -25 lines
Fixed multiple bugs that cause null pointers to be followed or FREEed data
to be accessed if a process blocks when it is being run down.

Revision 1.20: download - view: text, markup, annotated - select for diffs
Sun Dec 18 13:56:50 1994 UTC (17 years, 1 month ago) by guido
Branches: MAIN
Diff to: previous 1.19: preferred, colored
Changes since revision 1.19: +2 -2 lines
Fix bug in sysctl_string so that when a string has a length that is to
short, it gets filled uop to its length. This matches the getdomainname
and gethostname manual pages.
(getbootfile also uses this function and I think it should have the same
behaviour)

This also fixes a bug with keyinit where the seed was not saved in
/etc/skeykeys. So S/Key should be fully functional again.

Reviewed by:
Submitted by:
Obtained from:

Revision 1.19: download - view: text, markup, annotated - select for diffs
Mon Nov 14 13:58:30 1994 UTC (17 years, 2 months ago) by bde
Branches: MAIN
CVS tags: RELEASE_2_0, OLAH_TTCP, BETA_2_0
Diff to: previous 1.18: preferred, colored
Changes since revision 1.18: +4 -11 lines
Move declarations of public functions to <sys/sysctl.h>.

Make some private data static.

Comment about MAXPATHLEN bytes of bloat for the kernel name.

Revision 1.18: download - view: text, markup, annotated - select for diffs
Sun Oct 16 03:52:14 1994 UTC (17 years, 3 months ago) by wollman
Branches: MAIN
CVS tags: ALPHA_2_0
Diff to: previous 1.17: preferred, colored
Changes since revision 1.17: +6 -3 lines
kern_clock.c: define dk_names[][].
kern_sysctl.c: call dev_sysctl for hw.devconf mib subtree
kern_devconf.c: sysctl-accessible device-configuration and -management
	interface

Revision 1.17: download - view: text, markup, annotated - select for diffs
Thu Oct 6 21:06:30 1994 UTC (17 years, 4 months ago) by davidg
Branches: MAIN
Diff to: previous 1.16: preferred, colored
Changes since revision 1.16: +2 -2 lines
Use tsleep() rather than sleep so that 'ps' is more informative about
the wait.

Revision 1.16: download - view: text, markup, annotated - select for diffs
Sun Oct 2 17:35:19 1994 UTC (17 years, 4 months ago) by phk
Branches: MAIN
Diff to: previous 1.15: preferred, colored
Changes since revision 1.15: +13 -8 lines
All of this is cosmetic.  prototypes, #includes, printfs and so on.  Makes
GCC a lot more silent.

Revision 1.15: download - view: text, markup, annotated - select for diffs
Fri Sep 23 19:07:17 1994 UTC (17 years, 4 months ago) by wollman
Branches: MAIN
Diff to: previous 1.14: preferred, colored
Changes since revision 1.14: +5 -1 lines
Add MIB variable kern.bootfile (R/W) giving the name of the booted kernel.
Kernel variable is kernelname[].

Revision 1.14: download - view: text, markup, annotated - select for diffs
Wed Sep 21 03:46:46 1994 UTC (17 years, 4 months ago) by wollman
Branches: MAIN
Diff to: previous 1.13: preferred, colored
Changes since revision 1.13: +1 -3 lines
Implemented loadable VFS modules, and made most existing filesystems
loadable.  (NFS is a notable exception.)

Revision 1.13: download - view: text, markup, annotated - select for diffs
Mon Sep 19 21:07:00 1994 UTC (17 years, 4 months ago) by ache
Branches: MAIN
Diff to: previous 1.12: preferred, colored
Changes since revision 1.12: +2 -2 lines
sysctl incorrectly check name[2] instead of name[1]

Revision 1.12: download - view: text, markup, annotated - select for diffs
Sun Sep 18 20:39:48 1994 UTC (17 years, 4 months ago) by wollman
Branches: MAIN
Diff to: previous 1.11: preferred, colored
Changes since revision 1.11: +7 -2 lines
Redo Kernel NTP PLL support, kernel side.

This code is mostly taken from the 1.1 port (which was in turn taken from
Dave Mills's kern.tar.Z example).  A few significant differences:

1) ntp_gettime() is now a MIB variable rather than a system call.  A few
fiddles are done in libc to make it behave the same.

2) mono_time does not participate in the PLL adjustments.

3) A new interface has been defined (in <machine/clock.h>) for doing
possibly machine-dependent things around the time of the clock update.
This is used in Pentium kernels to disable interrupts, set `time', and
reset the CPU cycle counter as quickly as possible to avoid jitter in
microtime().  Measurements show an apparent resolution of a bit more than
8.14usec, which is reasonable given system-call overhead.

Revision 1.11: download - view: text, markup, annotated - select for diffs
Fri Sep 16 00:53:58 1994 UTC (17 years, 4 months ago) by ache
Branches: MAIN
Diff to: previous 1.10: preferred, colored
Changes since revision 1.10: +1 -4 lines
KERN_ADJKERNTZ removed from here to cpu_sysctl MACHDEP section

Revision 1.10: download - view: text, markup, annotated - select for diffs
Wed Sep 14 23:21:00 1994 UTC (17 years, 4 months ago) by ache
Branches: MAIN
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +4 -1 lines
KERN_ADJKERNTZ added in preparation of resettodr() implementation

Revision 1.9: download - view: text, markup, annotated - select for diffs
Fri Sep 9 23:12:47 1994 UTC (17 years, 5 months ago) by wollman
Branches: MAIN
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +4 -1 lines
Define new MIB variable, hw.floatingpoint, which is true if FP hardware
is present, and false if an emulator is being used.

Revision 1.8: download - view: text, markup, annotated - select for diffs
Thu Aug 18 22:35:04 1994 UTC (17 years, 5 months ago) by wollman
Branches: MAIN
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +2 -2 lines
Fix up some sloppy coding practices:

- Delete redundant declarations.
- Add -Wredundant-declarations to Makefile.i386 so they don't come back.
- Delete sloppy COMMON-style declarations of uninitialized data in
  header files.
- Add a few prototypes.
- Clean up warnings resulting from the above.

NB: ioconf.c will still generate a redundant-declaration warning, which
is unavoidable unless somebody volunteers to make `config' smarter.

Revision 1.7: download - view: text, markup, annotated - select for diffs
Wed Aug 10 06:25:02 1994 UTC (17 years, 6 months ago) by wollman
Branches: MAIN
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +3 -0 lines
Make it easier for programs to figure out what revision of FreeBSD they
are running under.  Here's how to bootstrap (order is important):

1) Re-compile gcc (just the driver is all you need).
2) Re-compile libc.
3) Re-compile your kernel.  Reboot.
4) cd /usr/src/include; make install

You can now detect the compilation environment with the following code:

#if !defined(__FreeBSD__)
#define __FreeBSD_version 199401
#elif __FreeBSD__ == 1
#define __FreeBSD_version 199405
#else
#include <osreldate.h>
#endif

You can determine the run-time environment by calling the new C library
function getosreldate(), or by examining the MIB variable kern.osreldate.

For the time being, the release date is defined as 199409, which we have
already established as our target.

Revision 1.6: download - view: text, markup, annotated - select for diffs
Wed Aug 10 02:41:09 1994 UTC (17 years, 6 months ago) by wollman
Branches: MAIN
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +2 -2 lines
Change default security level to -1, so that users don't get bitten by
upcoming makefile change.

Revision 1.5: download - view: text, markup, annotated - select for diffs
Mon Aug 8 15:40:58 1994 UTC (17 years, 6 months ago) by wollman
Branches: MAIN
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +15 -1 lines
Run-time configuration of VFS update interval.  Old UPDATE_INTERVAL
configuration option is no longer supported.

Revision 1.4: download - view: text, markup, annotated - select for diffs
Mon Aug 8 00:30:03 1994 UTC (17 years, 6 months ago) by wollman
Branches: MAIN
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +9 -1 lines
Define a sysctl MIB variable for the YP domain name.

Revision 1.3: download - view: text, markup, annotated - select for diffs
Tue Aug 2 07:42:19 1994 UTC (17 years, 6 months ago) by davidg
Branches: MAIN
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +1 -0 lines
Added $Id$

Revision 1.2: download - view: text, markup, annotated - select for diffs
Wed May 25 09:04:07 1994 UTC (17 years, 8 months ago) by rgrimes
Branches: MAIN
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +12 -1 lines
The big 4.4BSD Lite to FreeBSD 2.0.0 (Development) patch.

Reviewed by:	Rodney W. Grimes
Submitted by:	John Dyson and David Greenman

Revision 1.1.1.1 (vendor branch): download - view: text, markup, annotated - select for diffs
Tue May 24 10:04:30 1994 UTC (17 years, 8 months ago) by rgrimes
Branches: CSRG
CVS tags: bsd_44_lite, REL_before_johndavid_2_0_0
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +0 -0 lines
BSD 4.4 Lite Kernel Sources

Revision 1.1: download - view: text, markup, annotated - select for diffs
Tue May 24 10:04:29 1994 UTC (17 years, 8 months ago) by rgrimes
Branches: MAIN
Initial revision

Diff request

This form allows you to request diffs between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

Log view options