OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.427 / (download) - annotate - [select for diffs], Fri Apr 12 16:07:09 2024 UTC (8 weeks, 3 days ago) by bluhm
Branch: MAIN
CVS Tags: HEAD
Changes since 1.426: +7 -1 lines
Diff to previous 1.426 (colored)

Split single TCP inpcb table into IPv4 and IPv6 parts.

With two separate TCP hash tables, each one becomes smaller.  When
we remove the exclusive net lock from TCP, contention on internet
PCB table mutex will be reduced.  UDP has been split earlier into
IPv4 and IPv6.  Replace branch conditions based on INP_IPV6 with
assertions.

OK mvs@

Revision 1.426 / (download) - annotate - [select for diffs], Fri Mar 29 06:50:06 2024 UTC (2 months, 1 week ago) by miod
Branch: MAIN
Changes since 1.425: +2 -3 lines
Diff to previous 1.425 (colored)

Remove one global variable duplicating uvmexp.pagesize.
ok guenther@ deraadt@

Revision 1.425 / (download) - annotate - [select for diffs], Sat Feb 10 15:28:16 2024 UTC (4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5
Changes since 1.424: +5 -6 lines
Diff to previous 1.424 (colored)

On kernels without ucom(4) support, 'sysctl hw.ucomnames' should return
the empty string, rather than error.
ok krw

Revision 1.424 / (download) - annotate - [select for diffs], Fri Jan 19 01:43:27 2024 UTC (4 months, 3 weeks ago) by bluhm
Branch: MAIN
Changes since 1.423: +3 -3 lines
Diff to previous 1.423 (colored)

Backout priterator() for walking allprocess list.

This approach does not work as LIST_NEXT() of a removed element
does not return NULL.  I causes a crash in syzcaller and triggers
kernel diagnostic assertion "vp->v_uvcount == 0" in sys/kern/kern_unveil.c
line 845 during reboot.  Unfortunately the backout brings back the
race in fill_file() and fstat(1) may crash the kernel.

Reported-by: syzbot+54fba1c004d7383d5e85@syzkaller.appspotmail.com

Revision 1.423 / (download) - annotate - [select for diffs], Thu Jan 18 08:48:32 2024 UTC (4 months, 3 weeks ago) by mvs
Branch: MAIN
Changes since 1.422: +7 -12 lines
Diff to previous 1.422 (colored)

Use solock() instead of netlock within fill_file(). This makes all
socket types protected. The netlock is still used while fill_file()
called through *table.inpt_queue walkthroughs, but this is the inet
sockets case.

ok bluhm

Revision 1.422 / (download) - annotate - [select for diffs], Mon Jan 15 15:47:37 2024 UTC (4 months, 3 weeks ago) by mvs
Branch: MAIN
Changes since 1.421: +3 -3 lines
Diff to previous 1.421 (colored)

Introduce priterator(), the `ps_list' iterator. Some of `allprocess'
list walkthroughs have context switch within, so make exit1() wait
until the last reference released.

Reported-by: syzbot+0e9dda76c42c82c626d7@syzkaller.appspotmail.com

ok bluhm claudio

Revision 1.421 / (download) - annotate - [select for diffs], Wed Jan 10 16:44:30 2024 UTC (5 months ago) by bluhm
Branch: MAIN
Changes since 1.420: +7 -1 lines
Diff to previous 1.420 (colored)

Split UDP PCB table into IPv4 and IPv6.

Having two hash tables instead of a common one, reduces table size
and contention on the per table lock.  The address family is always
known in advance.  The lookups and loops are more specific.

OK sashan@

Revision 1.420 / (download) - annotate - [select for diffs], Sun Oct 1 15:58:12 2023 UTC (8 months, 1 week ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4
Changes since 1.419: +12 -1 lines
Diff to previous 1.419 (colored)

Add sysctl hw.ucomnames to list 'fixed' paths to USB serial
ports.

Suggested by deraadt@, USB route idea from kettenis@. Feedback
from anton@, man page improvements from deraadt@, jmc@,
schwarze@.

ok deraadt@ kettenis@

Revision 1.419 / (download) - annotate - [select for diffs], Sat Sep 16 09:33:27 2023 UTC (8 months, 3 weeks ago) by mpi
Branch: MAIN
Changes since 1.418: +2 -2 lines
Diff to previous 1.418 (colored)

Allow counters_read(9) to take an optional scratch buffer.

Using a scratch buffer makes it possible to take a consistent snapshot of
per-CPU counters without having to allocate memory.

Makes ddb(4) show uvmexp command work in OOM situations.

ok kn@, mvs@, cheloha@

Revision 1.418 / (download) - annotate - [select for diffs], Sun Jul 16 03:01:31 2023 UTC (10 months, 3 weeks ago) by yasuoka
Branch: MAIN
Changes since 1.417: +10 -12 lines
Diff to previous 1.417 (colored)

Make the mbstat preserve the same size which is actually used.  Also
revert the previous that the mbstat is located on the stack.

ok claudio

Revision 1.417 / (download) - annotate - [select for diffs], Fri Jul 7 16:27:46 2023 UTC (11 months ago) by bluhm
Branch: MAIN
Changes since 1.416: +12 -10 lines
Diff to previous 1.416 (colored)

Expand the counters in struct mbstat from u_short to u_long.  Use
malloc(9) memory instead of kernel stack for sysctl kern.mbstat.

from yasuoka@; chunk missed in previous commit; OK claudio@ tb@

Revision 1.416 / (download) - annotate - [select for diffs], Sun Jul 2 19:02:27 2023 UTC (11 months, 1 week ago) by cheloha
Branch: MAIN
Changes since 1.415: +1 -3 lines
Diff to previous 1.415 (colored)

all platforms, kernel: remove __HAVE_CLOCKINTR symbol

Every platform made the clockintr switch at least six months ago.
The __HAVE_CLOCKINTR symbol is now redundant.  Remove it.

Prompted by claudio@.

Link: https://marc.info/?l=openbsd-tech&m=168826181015032&w=2

"makes sense" mlarkin@

Revision 1.415 / (download) - annotate - [select for diffs], Sun May 21 12:47:54 2023 UTC (12 months, 3 weeks ago) by claudio
Branch: MAIN
Changes since 1.414: +2 -2 lines
Diff to previous 1.414 (colored)

In sysctl_hwchargestop() check that hw_battery_setchargestop is set
and not hw_battery_setchargestart.
OK kettenis@

Revision 1.414 / (download) - annotate - [select for diffs], Thu May 18 10:23:19 2023 UTC (12 months, 3 weeks ago) by mvs
Branch: MAIN
Changes since 1.413: +5 -12 lines
Diff to previous 1.413 (colored)

Backout sysctl(2) unlocking. Lock order issue was triggered in UVM
layer.

Revision 1.413 / (download) - annotate - [select for diffs], Wed May 17 22:12:51 2023 UTC (12 months, 3 weeks ago) by kettenis
Branch: MAIN
Changes since 1.412: +103 -3 lines
Diff to previous 1.412 (colored)

Implement battery management sysctl.  This will provide a set of sysctls
to control the charging of laptop batteries:

* hw.battery.chargemode (int)

  -1: force discharge
   0: inhibit charge
   1: auto

In auto mode charging may be controlled by:

* hw.battery.chargestop (int)

  Percentage (0-100) of last full capacity at which the battery should
  stop charging.

* hw.battery.chargestart (int)

  Percentage (0-100) of last full capacity at which the battery should
  start charging.

The idea is that with

  hw.battery.chargemode=1
  hw.battery.chargestop=80
  hw.battery.chargestart=75

the battery would be kept charged within the range between 75% and 80%.

Allowable settings and some details of the behavior may differ between
hardware implementations.

Committing this early to easy testing of further diffs that implement this
functionality in acpithinkpad(4) and aplsmc(4).

ok kn@

Revision 1.412 / (download) - annotate - [select for diffs], Thu May 4 09:40:36 2023 UTC (13 months, 1 week ago) by mvs
Branch: MAIN
Changes since 1.411: +12 -5 lines
Diff to previous 1.411 (colored)

Push kernel lock deep down to sys_sysctl(). At least network subset of
sysctl(8) MIBs relies on netlock or another locks and doesn't require
kernel lock, so unlock it. The protocols layer *_sysctl()s are left
under kernel lock and will be sequentially unlocked later.

ok bluhm@

Revision 1.411 / (download) - annotate - [select for diffs], Sun Jan 22 12:05:44 2023 UTC (16 months, 2 weeks ago) by mvs
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.410: +3 -2 lines
Diff to previous 1.410 (colored)

Move SS_CANTRCVMORE and SS_RCVATMARK bits from `so_state' to `sb_state' of
receive buffer. As it was done for SS_CANTSENDMORE bit, the definition
kept as is, but now these bits belongs to the `sb_state' of receive
buffer. `sb_state' ored with `so_state' when socket data exporting to the
userland.

ok bluhm@

Revision 1.410 / (download) - annotate - [select for diffs], Sat Jan 21 11:23:23 2023 UTC (16 months, 2 weeks ago) by mvs
Branch: MAIN
Changes since 1.409: +2 -2 lines
Diff to previous 1.409 (colored)

Introduce per-sockbuf `sb_state' to use it with SS_CANTSENDMORE.

This time, socket's buffer lock requires solock() to be held. As a part of
socket buffers standalone locking work, move socket state bits which
represent its buffers state to per buffer state.

Opposing the previous reverted diff, the SS_CANTSENDMORE definition left
as is, but it used only with `sb_state'. `sb_state' ored with original
`so_state' when socket's data exported to the userland, so the ABI kept as
it was.

Inputs from deraadt@.

ok bluhm@

Revision 1.409 / (download) - annotate - [select for diffs], Sat Jan 14 01:04:55 2023 UTC (16 months, 3 weeks ago) by cheloha
Branch: MAIN
Changes since 1.408: +2 -1 lines
Diff to previous 1.408 (colored)

sysctl(2): KERN_CPUSTATS: zero struct cpustats before copyout

Revision 1.408 / (download) - annotate - [select for diffs], Mon Nov 7 14:25:44 2022 UTC (19 months ago) by robert
Branch: MAIN
Changes since 1.407: +3 -1 lines
Diff to previous 1.407 (colored)

introduce a new kern.autoconf_serial sysctl that can be used by userland
to monitor state changes of the kernel device tree

input from dnd ok dlg@, deraadt@

Revision 1.407 / (download) - annotate - [select for diffs], Sat Nov 5 19:29:46 2022 UTC (19 months ago) by cheloha
Branch: MAIN
Changes since 1.406: +7 -1 lines
Diff to previous 1.406 (colored)

clockintr(9): initial commit

clockintr(9) is a machine-independent clock interrupt scheduler.  It
emulates most of what the machine-dependent clock interrupt code is
doing on every platform.  Every CPU has a work schedule based on the
system uptime clock.  For now, every CPU has a hardclock(9) and a
statclock().  If schedhz is set, every CPU has a schedclock(), too.

This commit only contains the MI pieces.  All code is conditionally
compiled with __HAVE_CLOCKINTR.  This commit changes no behavior yet.

At a high level, clockintr(9) is configured and used as follows:

1. During boot, the primary CPU calls clockintr_init(9).  Global state
   is initialized.
2. Primary CPU calls clockintr_cpu_init(9).  Local, per-CPU state is
   initialized.  An "intrclock" struct may be installed, too.
3. Secondary CPUs call clockintr_cpu_init(9) to initialize their
   local state.
4. All CPUs repeatedly call clockintr_dispatch(9) from the MD clock
   interrupt handler.  The CPUs complete work and rearm their local
   interrupt clock, if any, during the dispatch.
5. Repeat step (4) until the system shuts down, suspends, or hibernates.
6. During resume, the primary CPU calls inittodr(9) and advances the
   system uptime.
7. Go to step (2).  This time around, clockintr_cpu_init(9) also
   advances the work schedule on the calling CPU to skip events that
   expired during suspend.  This prevents a "thundering herd" of
   useless work during the first clock interrupt.

In the long term, we need an MI clock interrupt scheduler in order to
(1) provide control over the clock interrupt to MI subsystems like
timeout(9) and dt(4) to improve their accuracy, (2) provide drivers
like acpicpu(4) a means for slowing or stopping the clock interrupt on
idle CPUs to conserve power, and (3) reduce the amount of duplicated
code in the MD clock interrupt code.

Before we can do any of that, though, we need to switch every platform
over to using clockintr(9) and do some cleanup.

Prompted by "the vmm(4) time bug," among other problems, and a
discussion at a2k19 on the subject.  Lots of design input from
kettenis@.  Early versions reviewed by kettenis@ and mlarkin@.
Platform-specific help and testing from kettenis@, gkoehler@,
mlarkin@, miod@, aoyama@, visa@, and dv@.  Babysitting and spiritual
guidance from mlarkin@ and kettenis@.

Link: https://marc.info/?l=openbsd-tech&m=166697497302283&w=2

ok kettenis@ mlarkin@

Revision 1.406 / (download) - annotate - [select for diffs], Tue Aug 16 13:29:52 2022 UTC (21 months, 3 weeks ago) by visa
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.405: +1 -2 lines
Diff to previous 1.405 (colored)

Remove obsolete kern.nselcoll sysctl.

OK millert@ deraadt@

Revision 1.405 / (download) - annotate - [select for diffs], Sun Aug 14 01:58:27 2022 UTC (21 months, 4 weeks ago) by jsg
Branch: MAIN
Changes since 1.404: +1 -2 lines
Diff to previous 1.404 (colored)

remove unneeded includes in sys/kern
ok mpi@ miod@

Revision 1.404 / (download) - annotate - [select for diffs], Tue Jul 26 14:53:45 2022 UTC (22 months, 2 weeks ago) by deraadt
Branch: MAIN
Changes since 1.403: +6 -3 lines
Diff to previous 1.403 (colored)

Only allow changing the domainname (from empty) before securelevel increase.
libc YP support has a couple of places where the domainname is cached, and
this results in wildly incoherent behaviour which could even be risky.
If you want to change the domainname, you will have to reboot.
ok beck miod

Revision 1.403 / (download) - annotate - [select for diffs], Tue Jul 5 15:06:16 2022 UTC (23 months, 1 week ago) by visa
Branch: MAIN
Changes since 1.402: +3 -3 lines
Diff to previous 1.402 (colored)

Remove old poll/select wakeup mechanism.

Also remove unneeded seltrue() and selfalse().

OK mpi@ jsg@

Revision 1.402 / (download) - annotate - [select for diffs], Mon Mar 21 09:12:34 2022 UTC (2 years, 2 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.401: +9 -1 lines
Diff to previous 1.401 (colored)

Header netinet/in_pcb.h includes sys/mutex.h now.  Recommit mutex
for PCB tables.  It does not break userland build anymore.

pf_socket_lookup() calls in_pcbhashlookup() in the PCB layer.  To
run pf in parallel, make parts of the stack MP safe.  Protect the
list and hashes in the PCB tables with a mutex.
Note that the protocol notify functions may call pf via tcp_output().
As the pf lock is a sleeping rw_lock, we must not hold a mutex.  To
solve this for now, collect these PCBs in inp_notify list and protect
it with exclusive netlock.
OK sashan@

Revision 1.401 / (download) - annotate - [select for diffs], Mon Mar 14 22:38:43 2022 UTC (2 years, 2 months ago) by tb
Branch: MAIN
Changes since 1.400: +0 -8 lines
Diff to previous 1.400 (colored)

Unbreak the tree, revert commitid aZ8fm4iaUnTCc0ul

This reverts the commit protecting the list and hashes in the PCB tables
with a mutex since the build of sysctl(8) breaks, as found by kettenis.

ok sthen

Revision 1.400 / (download) - annotate - [select for diffs], Mon Mar 14 17:23:00 2022 UTC (2 years, 2 months ago) by bluhm
Branch: MAIN
Changes since 1.399: +9 -1 lines
Diff to previous 1.399 (colored)

pf_socket_lookup() calls in_pcbhashlookup() in the PCB layer.  To
run pf in parallel, make parts of the stack MP safe.  Protect the
list and hashes in the PCB tables with a mutex.
Note that the protocol notify functions may call pf via tcp_output().
As the pf lock is a sleeping rw_lock, we must not hold a mutex.  To
solve this for now, collect these PCBs in inp_notify list and protect
it with exclusive netlock.
OK sashan@

Revision 1.399 / (download) - annotate - [select for diffs], Tue Jan 25 04:04:40 2022 UTC (2 years, 4 months ago) by gnezdo
Branch: MAIN
Changes since 1.398: +20 -15 lines
Diff to previous 1.398 (colored)

Capture a repeated pattern into sysctl_securelevel_int function

A few variables in the kernel are only writeable before securelevel is
raised. It makes sense to handle them with less code.

OK sthen@ bluhm@

Revision 1.398 / (download) - annotate - [select for diffs], Thu Dec 23 10:17:01 2021 UTC (2 years, 5 months ago) by bluhm
Branch: MAIN
Changes since 1.397: +13 -13 lines
Diff to previous 1.397 (colored)

Use TAILQ_FOREACH to traverse the disk list in sysctl_diskinit().
OK anton@

Revision 1.397 / (download) - annotate - [select for diffs], Wed Dec 22 22:20:13 2021 UTC (2 years, 5 months ago) by bluhm
Branch: MAIN
Changes since 1.396: +22 -9 lines
Diff to previous 1.396 (colored)

While malloc sleeps, the disk list could change during sysctl.  Then
allocated memory could be too short for the list of disks.  Retry
allocating enough space until it did not change.
The disk list and duid memory are protected by kernel lock.  Use
asserts to mark this explicitly.
Reported-by: syzbot+807423f6868bbfb836bc@syzkaller.appspotmail.com
OK anton@ mpi@

Revision 1.396 / (download) - annotate - [select for diffs], Sat Oct 30 23:24:48 2021 UTC (2 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.395: +3 -1 lines
Diff to previous 1.395 (colored)

Change hw.perfpolicy=auto by default, at startup.  If the system has AC
power connected (default is yes when no driver differentiates) then default
to 100% performance. On battery, use the existing auto algorithm (which is
admittedly somewhat unrefined).
This change overrides the system/BIOS speed and puts OpenBSD in control.
As this happens very early during boot, besides speedups in all usage usage
patterns, some surprises: unhibernate and sysupgrade times are cut in half.
note: on a few architectures, the setperf fn pointer is changed late, and
thus the auto algorithm stops timeing out.  kettenis and i will look for
a solution.
in snaps for more than a week.
ok kettenis

Revision 1.395 / (download) - annotate - [select for diffs], Sun Oct 24 00:02:25 2021 UTC (2 years, 7 months ago) by jsg
Branch: MAIN
Changes since 1.394: +2 -2 lines
Diff to previous 1.394 (colored)

use NULL not 0 for pointer values in kern
ok semarie@

Revision 1.394 / (download) - annotate - [select for diffs], Tue May 4 21:57:15 2021 UTC (3 years, 1 month ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.393: +23 -20 lines
Diff to previous 1.393 (colored)

Reorder the integer sysctl functions.  Then the traditional 4.4BSD
comment 'As above...' makes sense again.  Improve comments for
sysctl_int_bounded() and sysctl_bounded_arr().
OK gnezdo@ mvs@

Revision 1.393 / (download) - annotate - [select for diffs], Tue May 4 19:04:56 2021 UTC (3 years, 1 month ago) by bluhm
Branch: MAIN
Changes since 1.392: +3 -3 lines
Diff to previous 1.392 (colored)

As the unbouded feature in sysctl_int_bounded() is no longer used,
remove it.  This also fixes a defective check of the dynamic boundary
in sysctl_sysvshm().
OK mvs@ gnezdo@

Revision 1.392 / (download) - annotate - [select for diffs], Sat May 1 16:18:28 2021 UTC (3 years, 1 month ago) by gnezdo
Branch: MAIN
Changes since 1.391: +26 -26 lines
Diff to previous 1.391 (colored)

Update the remaining SYSCTL_INT_READONLY cases

OK mvs@

Revision 1.391 / (download) - annotate - [select for diffs], Fri Apr 30 13:52:48 2021 UTC (3 years, 1 month ago) by bluhm
Branch: MAIN
Changes since 1.390: +28 -28 lines
Diff to previous 1.390 (colored)

Rearrange the implementation of bounded sysctl.  The primitive
functions are sysctl_int() and sysctl_rdint().  This brings us back
the 4.4BSD implementation.  Then sysctl_int_bounded() builds the
magic for range checks on top.  sysctl_bounded_arr() is a wrapper
around it to support multiple variables.
Introduce macros that describe the meaning of the magic boundary
values.  Use these macros in obvious places.
input and OK gnezdo@ mvs@

Revision 1.390 / (download) - annotate - [select for diffs], Fri Apr 23 07:21:02 2021 UTC (3 years, 1 month ago) by bluhm
Branch: MAIN
Changes since 1.389: +7 -12 lines
Diff to previous 1.389 (colored)

Remove the sysctl kern.allowdt code from kernel if dt(4) is not
configured.  This will result in a "value is not available" error
from sysctl when trying to enable dt on a kernel without support.
The variable allowdt should be in the device, not in sysctl source.
We don't need #ifdef for extern and prototypes.
OK mpi@

Revision 1.389 / (download) - annotate - [select for diffs], Mon Feb 8 10:51:02 2021 UTC (3 years, 4 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.388: +3 -3 lines
Diff to previous 1.388 (colored)

Revert the convertion of per-process thread into a SMR_TAILQ.

We did not reach a consensus about using SMR to unlock single_thread_set()
so there's no point in keeping this change.

Revision 1.388 / (download) - annotate - [select for diffs], Sun Jan 17 15:28:22 2021 UTC (3 years, 4 months ago) by mvs
Branch: MAIN
Changes since 1.387: +2 -2 lines
Diff to previous 1.387 (colored)

Cache parent's pid as `ps_ppid' and use it instead of `ps_pptr->ps_pid'.
This allows us to unlock getppid(2).

ok mpi@

Revision 1.387 / (download) - annotate - [select for diffs], Sat Jan 9 23:33:18 2021 UTC (3 years, 5 months ago) by gnezdo
Branch: MAIN
Changes since 1.386: +46 -42 lines
Diff to previous 1.386 (colored)

Split hierarchical calls into kern_sysctl_dirs

Removed a rash of +/-1 and made both functions shorter and more focused.

OK millert@

Revision 1.386 / (download) - annotate - [select for diffs], Sat Jan 9 22:00:13 2021 UTC (3 years, 5 months ago) by gnezdo
Branch: MAIN
Changes since 1.385: +85 -108 lines
Diff to previous 1.385 (colored)

Reduce case duplication in kern_sysctl

This changes amd64 GENERIC.MP .text size of kern_sysctl.o from 6440 to 6400.
Surprisingly, RAMDISK grows from 1645 to 1678.

OK millert@, mglocker@

Revision 1.385 / (download) - annotate - [select for diffs], Mon Dec 28 18:28:11 2020 UTC (3 years, 5 months ago) by mglocker
Branch: MAIN
Changes since 1.384: +29 -1 lines
Diff to previous 1.384 (colored)

Analog to the the kern.audio.record sysctl parameter for audio(4)
devices, introduce kern.video.record for video(4) devices.  By default
kern.video.record will be set to zero, blanking all data delivered
by device drivers which attach to video(4).

The idea was initially proposed by
Laurence Tratt <laurie AT tratt DOT net>.

ok mpi@

Revision 1.384 / (download) - annotate - [select for diffs], Mon Dec 7 16:55:29 2020 UTC (3 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.383: +3 -3 lines
Diff to previous 1.383 (colored)

Convert the per-process thread list into a SMR_TAILQ.

Currently all iterations are done under KERNEL_LOCK() and therefor use
the *_LOCKED() variant.

From and ok claudio@

Revision 1.383 / (download) - annotate - [select for diffs], Mon Nov 16 06:42:12 2020 UTC (3 years, 6 months ago) by gnezdo
Branch: MAIN
Changes since 1.382: +15 -12 lines
Diff to previous 1.382 (colored)

Convert hw_sysctl to sysctl_bounded_args

This one is surprisingly a minor loss if one were to simply add bytes
on amd64:
       .text+.data+.bss+.rodata
before 0x64b0+0x40+0x14+0x338 = 0x683c
after  0x6440+0x48+0x14+0x3b8 = 0x6854

Revision 1.382 / (download) - annotate - [select for diffs], Mon Nov 16 06:37:07 2020 UTC (3 years, 6 months ago) by gnezdo
Branch: MAIN
Changes since 1.381: +74 -103 lines
Diff to previous 1.381 (colored)

Convert kern_sysctl to sysctl_bounded_args

objdump -h changes in Size of kern_sysctl.o on amd64
	before  after
.text	  7140	 64b0
.data       24     40
.bss        10     14
.rodata     50    338

Revision 1.381 / (download) - annotate - [select for diffs], Sat Nov 7 05:24:20 2020 UTC (3 years, 7 months ago) by gnezdo
Branch: MAIN
Changes since 1.380: +9 -3 lines
Diff to previous 1.380 (colored)

Convert ffs_sysctl to sysctl_bounded_args

Requires sysctl_bounded_arr branch to support sysctl_rdint.
The read-only variables are marked by an empty range of [1, 0].

OK millert@

Revision 1.380 / (download) - annotate - [select for diffs], Mon Oct 19 08:19:46 2020 UTC (3 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.379: +3 -3 lines
Diff to previous 1.379 (colored)

Serialize accesses to "struct vmspace" and document its refcounting.

The underlying vm_space lock is used as a substitute to the KERNEL_LOCK()
in uvm_grow() to make sure `vm_ssize' is not corrupted.

ok anton@, kettenis@

Revision 1.379 / (download) - annotate - [select for diffs], Tue Sep 1 01:53:50 2020 UTC (3 years, 9 months ago) by gnezdo
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.378: +1 -15 lines
Diff to previous 1.378 (colored)

Remove unused sysctl_int_arr(9)

Revision 1.378 / (download) - annotate - [select for diffs], Sun Aug 23 09:35:32 2020 UTC (3 years, 9 months ago) by kn
Branch: MAIN
Changes since 1.377: +5 -4 lines
Diff to previous 1.377 (colored)

Remove unused debug_syncprt, improve debug sysctl handling

"syncprt" is unused since kern/vfs_syscalls.c r1.147 from 2008.

Adding new debug sysctls is a bit opaque and looking at kern/kern_sysctl.c
the only visible difference between used and stub ctldebug structs in the
debugvars[] array is their extern keyword, indicating that it is defined
elsewhere.

sys/sysctl.h declares all debugN members as extern upfront, but these
declarations are not needed.

Remove the unused debug sysctl, rename the only remaining one to something
meaningful and remove forward declarations from /sys/sysctl.h;  this way,
adding new debug sysctls is a matter of adding extern and coming up with a
name, which is nicer to read on its own and better to grep for.

OK mpi

Revision 1.377 / (download) - annotate - [select for diffs], Sat Aug 22 11:47:23 2020 UTC (3 years, 9 months ago) by kn
Branch: MAIN
Changes since 1.376: +4 -4 lines
Diff to previous 1.376 (colored)

Move sysctl(2) CTL_DEBUG from DEBUG to new DEBUG_SYSCTL

Adding "debug.my-knob" sysctls is really helpful to select different
code paths and/or log on demand during runtime without recompile,
but as this code is under DEBUG, lots of other noise comes with it
which is often undesired, at least when looking at specific subsystems
only.

Adding globals to the kernel and breaking into DDB to change them helps,
but that does not work over SSH, hence the need for debug sysctls.

Introduces DEBUG_SYSCTL to make use of the "debug" MIB without the rest of
DEBUG; it's DEBUG_SYSCTL and not SYSCTL_DEBUG because it's not a general
option for all of sysctl(2).

OK gnezdo

Revision 1.376 / (download) - annotate - [select for diffs], Tue Aug 18 18:19:30 2020 UTC (3 years, 9 months ago) by gnezdo
Branch: MAIN
Changes since 1.375: +4 -4 lines
Diff to previous 1.375 (colored)

Style fixups from hurried commits

Thanks kettenis@ for pointing out.

ok kettenis@

Revision 1.375 / (download) - annotate - [select for diffs], Tue Aug 18 04:48:11 2020 UTC (3 years, 9 months ago) by gnezdo
Branch: MAIN
Changes since 1.374: +33 -2 lines
Diff to previous 1.374 (colored)

Add sysctl_bounded_arr as a replacement for sysctl_int_arr

Design by deraadt@

ok deraadt@

Revision 1.374 / (download) - annotate - [select for diffs], Sat Aug 1 23:41:55 2020 UTC (3 years, 10 months ago) by gnezdo
Branch: MAIN
Changes since 1.373: +3 -3 lines
Diff to previous 1.373 (colored)

Move range check inside sysctl_int_arr

Range violations are now consistently reported as EOPNOTSUPP.
Previously they were mixed with ENOPROTOOPT.

OK kn@

Revision 1.373 / (download) - annotate - [select for diffs], Mon Jun 22 02:45:18 2020 UTC (3 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.372: +2 -3 lines
Diff to previous 1.372 (colored)

there's not going to be any whole kernel wide network livelocks soon.

Revision 1.372 / (download) - annotate - [select for diffs], Fri May 29 01:22:53 2020 UTC (4 years ago) by deraadt
Branch: MAIN
Changes since 1.371: +1 -2 lines
Diff to previous 1.371 (colored)

rndvar.h not needed here

Revision 1.354.2.1 / (download) - annotate - [select for diffs], Tue Mar 10 15:57:29 2020 UTC (4 years, 3 months ago) by tb
Branch: OPENBSD_6_5
Changes since 1.354: +2 -2 lines
Diff to previous 1.354 (colored) next main 1.355 (colored)

Return EINVAL for KERN_PROC if the size parameter is 0.
Prevents a panic due to a NULL dereference; Coverity CID 1452899.
Based on a diff from mpi@, OK deraadt@ kettenis@

OpenBSD 6.5 errata 032 (6.5/032_sysctl.patch.sig)

Revision 1.366.2.1 / (download) - annotate - [select for diffs], Tue Mar 10 15:57:22 2020 UTC (4 years, 3 months ago) by tb
Branch: OPENBSD_6_6
Changes since 1.366: +2 -2 lines
Diff to previous 1.366 (colored) next main 1.367 (colored)

Return EINVAL for KERN_PROC if the size parameter is 0.
Prevents a panic due to a NULL dereference; Coverity CID 1452899.
Based on a diff from mpi@, OK deraadt@ kettenis@

OpenBSD 6.6 errata 022 (6.6/022_sysctl.patch.sig)

Revision 1.371 / (download) - annotate - [select for diffs], Mon Mar 9 19:59:53 2020 UTC (4 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.370: +2 -2 lines
Diff to previous 1.370 (colored)

Return EINVAL for KERN_PROC if the size parameter is 0.
Prevents a panic due to a NULL dereference; Coverity CID 1452899.
Based on a diff from mpi@, OK deraadt@ kettenis@

Revision 1.370 / (download) - annotate - [select for diffs], Fri Jan 24 14:00:31 2020 UTC (4 years, 4 months ago) by mpi
Branch: MAIN
Changes since 1.369: +8 -5 lines
Diff to previous 1.369 (colored)

New `kern.allowdt' button must be set to open(2) /dev/dt.

dt(4) exposes kernel internals, addresses and content of states to
userland.  As such its interface shouldn't be available without
enabling it consciously.

ok millert@, deraadt@

Revision 1.369 / (download) - annotate - [select for diffs], Thu Jan 2 08:52:53 2020 UTC (4 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.368: +6 -3 lines
Diff to previous 1.368 (colored)

Exclude offline cpus in KERN_CPTIME calculation. Without this too high
idle time is reported in tools like vmstat.
OK visa@ benno@ krw@

Revision 1.368 / (download) - annotate - [select for diffs], Wed Dec 11 07:30:09 2019 UTC (4 years, 6 months ago) by guenther
Branch: MAIN
Changes since 1.367: +2 -1 lines
Diff to previous 1.367 (colored)

Replace p_xstat with ps_xexit and ps_xsig
Convert those to a consolidated status when needed in wait4(), kevent(),
	and sysctl()
Pass exit code and signal separately to exit1()
(This also serves as prep for adding waitid(2))

ok mpi@

Revision 1.367 / (download) - annotate - [select for diffs], Tue Oct 22 21:19:22 2019 UTC (4 years, 7 months ago) by cheloha
Branch: MAIN
Changes since 1.366: +8 -2 lines
Diff to previous 1.366 (colored)

struct proc: change ps_start from utc time to uptime

Allows us to determine how long a process has been running, even if the
UTC clock jumps.

With help from bluhm@ and millert@, who squashed several bugs.

ok bluhm@ millert@

Revision 1.366 / (download) - annotate - [select for diffs], Wed Aug 21 20:44:09 2019 UTC (4 years, 9 months ago) by cheloha
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE
Branch point for: OPENBSD_6_6
Changes since 1.365: +35 -1 lines
Diff to previous 1.365 (colored)

sysctl(2): add kern.utc_offset: successor to the DST/TIMEZONE options(4)

The DST and TIMEZONE options(4) are incompatible with KARL, so we need
some other way to compensate for an RTC running with a known offset.

Enter kern.utc_offset, an offset in minutes East of UTC.  TIMEZONE has
always been minutes West, but this is inconsistent with how everyone
else talks about timezones, hence the flip.

TIMEZONE has the advantage of being compiled into the binary.  Our new
sysctl(2) has no such luck, so it needs to be set as early as possible
in boot, from sysctl.conf(5), so we can correct the kernel clock from
the RTC's local time to UTC before daemons like ntpd(8) and cron(8)
start.  To encourage this, kern.utc_offset is made immutable after the
securelevel(7) is raised to 1.

Prompted by yasuoka@.  Discussed with deraadt@, kettenis@, yasuoka@.
Additional testing by yasuoka@.

ok deraadt@, yasuoka@

Revision 1.365 / (download) - annotate - [select for diffs], Mon Aug 5 08:35:59 2019 UTC (4 years, 10 months ago) by anton
Branch: MAIN
Changes since 1.364: +2 -2 lines
Diff to previous 1.364 (colored)

Allow concurrent reads of the f_offset field of struct file by
serializing both read/write operations using the existing file mutex.
The vnode lock still grants exclusive write access to the offset; the
mutex is only used to make the actual write atomic and prevent any
concurrent reader from observing intermediate values.

ok mpi@ visa@

Revision 1.364 / (download) - annotate - [select for diffs], Tue Jul 16 17:39:02 2019 UTC (4 years, 10 months ago) by bluhm
Branch: MAIN
Changes since 1.363: +7 -7 lines
Diff to previous 1.363 (colored)

Prevent integer overflow in kernel and userland when checking mbuf
limits.  Convert kernel variables and calculations for mbuf memory
into long to allow larger values on 64 bit machines.  Put a range
check into the kernel sysctl.  For the interface itself int is still
sufficient.  In netstat -m cast all multiplications to unsigned
long to hold the product of two unsigned int.
input and OK visa@

Revision 1.363 / (download) - annotate - [select for diffs], Fri Jul 12 13:56:27 2019 UTC (4 years, 11 months ago) by solene
Branch: MAIN
Changes since 1.362: +2 -2 lines
Diff to previous 1.362 (colored)

Revert anton@ changes about read/write unlocking
https://marc.info/?l=openbsd-cvs&m=156277704122293&w=2

ok anton@

Revision 1.362 / (download) - annotate - [select for diffs], Fri Jul 12 00:04:59 2019 UTC (4 years, 11 months ago) by cheloha
Branch: MAIN
Changes since 1.361: +3 -1 lines
Diff to previous 1.361 (colored)

sysctl(2): add KERN_TIMEOUT_STATS: timeout(9) status and statistics.

With these totals one can track the throughput of the timeout(9) layer
from userspace.

With input from mpi@.

ok mpi@

Revision 1.361 / (download) - annotate - [select for diffs], Wed Jul 10 16:43:19 2019 UTC (4 years, 11 months ago) by anton
Branch: MAIN
Changes since 1.360: +2 -2 lines
Diff to previous 1.360 (colored)

Make read/write of the f_offset field belonging to struct file MP-safe;
as part of the effort to unlock the kernel. Instead of relying on the
vnode lock, introduce a dedicated lock per file. Exclusive write access
is granted using the new foffset_enter and foffset_leave API. A
convenience function foffset_get is also available for threads that only
need to read the current offset.

The lock acquisition order in vn_write has been changed to match the one
in vn_read in order to avoid a potential deadlock. This change also gets
rid of a documented race in vn_read().

Inspired by the FreeBSD implementation.

With help and ok mpi@ visa@

Revision 1.360 / (download) - annotate - [select for diffs], Sun Jun 16 00:56:53 2019 UTC (4 years, 11 months ago) by bluhm
Branch: MAIN
Changes since 1.359: +5 -2 lines
Diff to previous 1.359 (colored)

In previous commit I forgot a net unlock if the PCB of the socket
was already gone.
OK mpi@

Revision 1.359 / (download) - annotate - [select for diffs], Thu Jun 13 20:52:36 2019 UTC (4 years, 11 months ago) by bluhm
Branch: MAIN
Changes since 1.358: +17 -2 lines
Diff to previous 1.358 (colored)

When tcp_close() is running in parallel with fill_file(), the kernel
could crash due to missing inp_ppcb.  This happend when fstat(1)
was called often and TCP was aborted with reset.  Protect the sysctl
path with the net lock.
OK mpi@

Revision 1.358 / (download) - annotate - [select for diffs], Sat Jun 1 14:11:17 2019 UTC (5 years ago) by mpi
Branch: MAIN
Changes since 1.357: +1 -3 lines
Diff to previous 1.357 (colored)

Revert to using the SCHED_LOCK() to protect time accounting.

It currently creates a lock ordering problem because SCHED_LOCK() is taken
by hardclock().  That means the "priorities" of a thread should be moved
out of the SCHED_LOCK() first in order to make progress.

Reported-by: syzbot+8e4863b3dde88eb706dc@syzkaller.appspotmail.com
via anton@ as well as by kettenis@

Revision 1.357 / (download) - annotate - [select for diffs], Fri May 31 19:51:09 2019 UTC (5 years ago) by mpi
Branch: MAIN
Changes since 1.356: +3 -1 lines
Diff to previous 1.356 (colored)

Use a per-process mutex to protect time accounting instead of SCHED_LOCK().

Note that hardclock(9) still increments p_{u,s,i}ticks without holding a
lock.

ok visa@, cheloha@

Revision 1.356 / (download) - annotate - [select for diffs], Wed May 22 18:45:07 2019 UTC (5 years ago) by claudio
Branch: MAIN
Changes since 1.355: +7 -3 lines
Diff to previous 1.355 (colored)

Read and assign the integer value only once. With this sysctl_int() will
do word loads and stores and so partial updates should no longer be observed.
With this accessing global variables set by sysctl_int() should be mostly MP
save.
OK dlg@ mpi@

Revision 1.355 / (download) - annotate - [select for diffs], Thu May 9 14:59:30 2019 UTC (5 years, 1 month ago) by claudio
Branch: MAIN
Changes since 1.354: +6 -1 lines
Diff to previous 1.354 (colored)

Add a sysctl accessor to struct pf_status. The pf_status only holds the
current status and statistics and can be exported without super-user
rights via sysctl to make it easier for tools like systat to access those.
OK deraadt@, sashan@

Revision 1.354 / (download) - annotate - [select for diffs], Tue Jan 29 14:07:15 2019 UTC (5 years, 4 months ago) by visa
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE
Branch point for: OPENBSD_6_5
Changes since 1.353: +5 -1 lines
Diff to previous 1.353 (colored)

Add a dedicated sysctl(2) node for witness(4).

The new node contains the subsystem's main control variable,
kern.witness.watch. It is aliased by the old name, kern.witnesswatch.
The alias will be removed in the future.

OK anton@ mpi@

Revision 1.353 / (download) - annotate - [select for diffs], Sat Jan 19 01:53:44 2019 UTC (5 years, 4 months ago) by cheloha
Branch: MAIN
Changes since 1.352: +2 -2 lines
Diff to previous 1.352 (colored)

Move boottime into the timehands.

To protect the timehands we first need to protect the basis for all UTC
time in the kernel: the boottime.

Because the boottime can be changed at any time it needs to be versioned
along with the other members of the timehands to enable safe lockless reads
when using it for anything.  So the global boottime timespec goes away and
the static boottimebin becomes a member of the timehands.  Instead of reading
the global boottime you use one of two interfaces: binboottime(9) or
microboottime(9). nanoboottime(9) can trivially be added later, though there
are no consumers for it at the moment.

This introduces one small change in behavior.  We used to advance the
reported boottime just before launching kernel threads from main().
This makes it look to userland like we "booted" moments before those
threads were launched.  Because there is no longer a boottime global we
can no longer trivially do this from main(), so the boottime we report
to userspace via e.g. kern.boottime will now reflect whatever the time
was when we bootstrapped the timehands via inittodr(9).  This is usually
no more than a minute before the kernel threads are launched from main().
The prior behavior can be restored by adding a new interface to the
timecounter layer in a future commit.

Based on FreeBSD r303387.

Discussed with mpi@ and visa@.

ok visa@

Revision 1.352 / (download) - annotate - [select for diffs], Mon Nov 19 16:12:06 2018 UTC (5 years, 6 months ago) by tedu
Branch: MAIN
Changes since 1.351: +1 -11 lines
Diff to previous 1.351 (colored)

delete the dns jackport experiment. it has no future.

Revision 1.351 / (download) - annotate - [select for diffs], Sat Nov 17 23:10:08 2018 UTC (5 years, 6 months ago) by cheloha
Branch: MAIN
Changes since 1.350: +35 -1 lines
Diff to previous 1.350 (colored)

Add new KERN_CPUSTATS sysctl(2) so we can identify offline CPUs.

Because of hw.smt we need a way to determine whether a given CPU is "online"
or "offline" from userspace.  KERN_CPTIME2 is an array, and so cannot be
cleanly extended for this purpose, so add a new sysctl(2) KERN_CPUSTATS
with an extensible struct.  At the moment it's just KERN_CPTIME2 with a
flags member, but it can grow as needed.

KERN_CPUSTATS appears to have been defined by BSDi long ago, but there are
few (if any) packages in the wild still using the symbol so breakage in ports
should be near zero.  No other system inherited the symbol from BSDi, either.

Then, use the new sysctl(2) in systat(1) and top(1):

  - systat(1) draws placeholder marks ('-') instead of percentages for
    offline CPUs in the cpu view.

  - systat(1) omits offline CPU ticks when drawing the "big bar" in
    the vmstat view.  The upshot is that the bar isn't half idle when
    half your logical CPUs are disabled.

  - top(1) does not draw lines for offline CPUs; if CPUs toggle on or
    offline in interactive mode we redraw the display to expand/reduce
    space for the new/missing CPUs.  This is consistent with what some
    top(1) implementations do on Linux.

  - top(1) omits offline CPUs from the totals when CPU totals are
    combined into a single line (the '-1' flag).

Originally prompted by deraadt@.  Discussed endlessly with deraadt@,
ketennis@, and sthen@.  Tested by jmc@ and jca@.  Earlier versions also
discussed with jca@.  Earlier versions tested by jmc@, tb@, and many
others.

docs ok jmc@, kernel bits ok ketennis@, everything ok sthen@,
"Is your stuff in yet?" deraadt@

Revision 1.350 / (download) - annotate - [select for diffs], Fri Oct 5 18:56:57 2018 UTC (5 years, 8 months ago) by cheloha
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.349: +1 -3 lines
Diff to previous 1.349 (colored)

Revert KERN_CPTIME2 ENODEV changes in kernel and userspace.

ok kettenis deraadt

Revision 1.349 / (download) - annotate - [select for diffs], Thu Oct 4 17:33:40 2018 UTC (5 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.348: +11 -26 lines
Diff to previous 1.348 (colored)

Revert the inpcb table mutex commit.  It triggers a witness panic
in raw IP delivery and UDP broadcast loops.  There inpcbtable_mtx
is held and sorwakeup() is called within the loop.  As sowakeup()
grabs the kernel lock, we have a lock ordering problem.
found by Hrvoje Popovski; OK deraadt@ mpi@

Revision 1.348 / (download) - annotate - [select for diffs], Wed Sep 26 17:23:13 2018 UTC (5 years, 8 months ago) by cheloha
Branch: MAIN
Changes since 1.347: +3 -1 lines
Diff to previous 1.347 (colored)

KERN_CPTIME2: set ENODEV if the CPU is offline.

This lets userspace distinguish between idle CPUs and those that are
not schedulable because hw.smt=0.

A subsequent commit probably needs to add documentation for this
to sysctl.2 (and perhaps elsewhere) after the dust settles.

Also included here are changes to systat(1) and top(1) that account
for the ENODEV case and adjust behavior accordingly:

 - systat(1)'s cpu view prints placeholder marks ('-') instead of
   percentages for each state if the given CPU is offline.

 - systat(1)'s vmstat view checks for offline CPUs when computing the
   machine state total and excludes them, so the CPU usage graph
   only represents the states for online CPUs.

 - top(1) does not draw CPU rows for offline CPUs when the view is
   redrawn.  If CPUs "go offline", percentages for each state are
   replaced by placeholder marks ('-'); the view will need to be
   redrawn to remove these rows.  If CPUs "go online" the view will
   need to be redrawn to show these new CPUs.  In "combined CPU" mode,
   the count and the state totals only represent online CPUs.

Ports using KERN_CPTIME2 will need to be updated.  The changes
described above to make systat(1) and top(1) aware of the ENODEV
case *and* gracefully handle a changing HW_NCPUONLINE while the
application is running are not necessarily appropriate for each
and every port.

The changes described above are so extensive in part to demonstrate
one way a program *might* be made robust to changing CPU availability.
In particular, changing hw.smt after boot is an extremely rare event,
and this needs to be weighed when updating ports.

The logic needed to account for the KERN_CPTIME2 ENODEV case is
very roughly:

	if (sysctl(...) == -1) {
		if (errno != ENODEV) {
			/* Actual error occurred. */
		} else {
			/* CPU is offline. */
		}
	} else {
		/* CPU is online and CPU states were set by sysctl(2). */
	}

Prompted by deraadt@.  Basic idea for ENODEV from kettenis@.  Discussed at
length with kettenis@.  Additional testing by tb@.

No complaints from hackers@ after a week.

ok kettenis@, "I think you should commit [now]" deraadt@

Revision 1.347 / (download) - annotate - [select for diffs], Thu Sep 20 18:59:10 2018 UTC (5 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.346: +26 -11 lines
Diff to previous 1.346 (colored)

As a step towards per inpcb or socket locks, remove the net lock
for netstat -a.  Introduce a global mutex that protects the tables
and hashes for the internet PCBs.  To detect detached PCB, set its
inp_socket field to NULL.  This has to be protected by a per PCB
mutex.  The protocol pointer has to be protected by the mutex as
netstat uses it.
Always take the kernel lock in in_pcbnotifyall() and in6_pcbnotify()
before the table mutex to avoid lock ordering problems in the notify
functions.
OK visa@

Revision 1.346 / (download) - annotate - [select for diffs], Thu Jul 12 01:23:38 2018 UTC (5 years, 11 months ago) by cheloha
Branch: MAIN
Changes since 1.345: +4 -1 lines
Diff to previous 1.345 (colored)

Add hw.ncpuonline to count the number of online CPUs.

The introduction of hw.smt means that logical CPUs can be disabled
after boot and prior to suspend/resume.  If hw.smt=0 (the default),
there needs to be a way to count the number of hardware threads
available on the system at any given time.

So, import HW_NCPUONLINE/hw.ncpuonline from NetBSD and document it.
hw.ncpu becomes equal to the number of CPUs given to sched_init_cpu()
during boot, while hw.ncpuonline is equal to the number of CPUs available
to the scheduler in the cpuset "sched_all_cpus". Set_SC_NPROCESSORS_ONLN
equal to this new sysctl and keep _SC_NPROCESSORS_CONF equal to hw.ncpu.

This is preferable to adding a new sysctl to count the number of
configured CPUs and keeping hw.ncpu equal to the number of online
CPUs because such a change would break software in the ecosystem
that relies on HW_NCPU/hw.ncpu to measure CPU usage and the like.
Such software in base includes top(1), systat(1), and snmpd(8),
and perhaps others.

We don't need additional locking to count the cardinality of a cpuset
in this case because the only interfaces that can modify said cardinality
are sysctl(2) and ioctl(2), both of which are under the KERNEL_LOCK.

Software using HW_NCPU/hw.ncpu to determine optimal parallism will need
to be updated to use HW_NCPUONLINE/hw.ncpuonline.  Until then, such software
may perform suboptimally.  However, most changes will be similar to the
change included here for libcxx's std::thread:hardware_concurrency():
using HW_NCPUONLINE in lieu of HW_NCPU should be sufficient for determining
optimal parallelism for most software if the change to _SC_NPROCESSORS_ONLN
is insufficient.

Prompted by deraadt. Discussed at length with kettenis, deraadt, and sthen.
Lots of patch tweaks from kettenis.

ok kettenis, "proceed" deraadt

Revision 1.345 / (download) - annotate - [select for diffs], Mon Jul 2 14:36:33 2018 UTC (5 years, 11 months ago) by visa
Branch: MAIN
Changes since 1.344: +1 -3 lines
Diff to previous 1.344 (colored)

Update the file reference count field `f_count' using atomic operations
instead of using a mutex for update serialization. Use a per-fdp mutex
to manage updating of file instance pointers in the `fd_ofiles' array
to let fd_getfile() acquire file references safely with concurrent file
reference releases.

OK mpi@

Revision 1.344 / (download) - annotate - [select for diffs], Sun Jul 1 16:33:15 2018 UTC (5 years, 11 months ago) by visa
Branch: MAIN
Changes since 1.343: +5 -2 lines
Diff to previous 1.343 (colored)

Lock the file descriptor table when accessing the `fd_ofileflags' array.
This prevents the array from being freed too early. In the function
unp_internalize(), the locking also ensures the per-fdp flags stay
coherent with the file instance.

OK mpi@

Revision 1.343 / (download) - annotate - [select for diffs], Wed Jun 20 10:52:49 2018 UTC (5 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.342: +3 -1 lines
Diff to previous 1.342 (colored)

Unlock sendmsg(2) and sendto(2).

These syscalls can now be executed w/o the KERNEL_LOCK() depending on
the kind of socket.

The current solution uses a single global mutex to serialize access to,
and reference count, 'struct file'.

ok visa@, kettenis@

Revision 1.342 / (download) - annotate - [select for diffs], Tue Jun 19 19:29:52 2018 UTC (5 years, 11 months ago) by kettenis
Branch: MAIN
Changes since 1.341: +5 -1 lines
Diff to previous 1.341 (colored)

SMT (Simultanious Multi Threading) implementations typically share
TLBs and L1 caches between threads.  This can make cache timing
attacks a lot easier and we strongly suspect that this will make
several spectre-class bugs exploitable.  Especially on Intel's SMT
implementation which is better known as Hypter-threading.  We really
should not run different security domains on different processor
threads of the same core.  Unfortunately changing our scheduler to
take this into account is far from trivial.  Since many modern
machines no longer provide the ability to disable Hyper-threading in
the BIOS setup, provide a way to disable the use of additional
processor threads in our scheduler.  And since we suspect there are
serious risks, we disable them by default.  This can be controlled
through a new hw.smt sysctl.  For now this only works on Intel CPUs
when running OpenBSD/amd64.  But we're planning to extend this feature
to CPUs from other vendors and other hardware architectures.

Note that SMT doesn't necessarily have a posive effect on performance;
it highly depends on the workload.  In all likelyhood it will actually
slow down most workloads if you have a CPU with more than two cores.

ok deraadt@

Revision 1.341 / (download) - annotate - [select for diffs], Sat Jun 2 16:38:21 2018 UTC (6 years ago) by bluhm
Branch: MAIN
Changes since 1.340: +1 -5 lines
Diff to previous 1.340 (colored)

Move the declarations of the raw ip and ip6 pcb tables into the
in_pcb.h header file.
OK mpi@ visa@

Revision 1.340 / (download) - annotate - [select for diffs], Sun May 27 08:11:13 2018 UTC (6 years ago) by ratchov
Branch: MAIN
Changes since 1.339: +3 -1 lines
Diff to previous 1.339 (colored)

Add missing #include "audio.h" needed for the NAUDIO macro.

suggested by jsg, ok sthen.

Revision 1.339 / (download) - annotate - [select for diffs], Sat May 26 14:36:35 2018 UTC (6 years ago) by sthen
Branch: MAIN
Changes since 1.338: +9 -2 lines
Diff to previous 1.338 (colored)

Condition the new audio_record_enable pieces on NAUDIO > 0, fixing
kernel builds without audio (for example, ramdisks). ok florian@

Revision 1.338 / (download) - annotate - [select for diffs], Sat May 26 10:16:14 2018 UTC (6 years ago) by ratchov
Branch: MAIN
Changes since 1.337: +20 -1 lines
Diff to previous 1.337 (colored)

In addition to "on" and "off", allow the audio "record.enable" mixer
knob to take the new "sysctl" value, which is the default. In this
case, the device behavior is determined by the new "kern.audio.record"
sysctl(2), which defaults to zero.

ok florian

Revision 1.337 / (download) - annotate - [select for diffs], Wed May 16 14:53:43 2018 UTC (6 years ago) by visa
Branch: MAIN
Changes since 1.336: +6 -1 lines
Diff to previous 1.336 (colored)

Add kern.witnesswatch sysctl for controlling witness(4). By default,
lock order checking is disabled but it can be enabled at runtime.

Suggested by deraadt@ / mpi@
OK mpi@

Revision 1.336 / (download) - annotate - [select for diffs], Tue May 8 14:15:30 2018 UTC (6 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.335: +5 -7 lines
Diff to previous 1.335 (colored)

Use fd_getfile() in sysctl_file() instead of rewriting it.

This gives use refcounting for free which is what we need for MP.

ok bluhm@, visa@

Revision 1.335 / (download) - annotate - [select for diffs], Tue May 8 09:03:58 2018 UTC (6 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.334: +2 -4 lines
Diff to previous 1.334 (colored)

Change fd_iterfile() to not return imature fps instead of skipping them
later.

ok bluhm@, visa@

Revision 1.334 / (download) - annotate - [select for diffs], Tue May 8 08:53:41 2018 UTC (6 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.333: +3 -1 lines
Diff to previous 1.333 (colored)

Protect per-file counters and document which lock is used to protect
the other fields.

Once we no longer have any [k] (kernel lock) protections, we'll be
able to unlock almost all network related syscalls.

Inputs from and ok bluhm@, visa@

Revision 1.333 / (download) - annotate - [select for diffs], Wed Apr 25 10:29:16 2018 UTC (6 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.332: +5 -18 lines
Diff to previous 1.332 (colored)

Introduce fd_iterfile() a new helper function to iterate over `filehead'.

This turns `filehead' into a local variable, that will make it easier
to protect it.

ok visa@

Revision 1.332 / (download) - annotate - [select for diffs], Mon Feb 19 08:59:52 2018 UTC (6 years, 3 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.331: +12 -12 lines
Diff to previous 1.331 (colored)

Remove almost unused `flags' argument of suser().

The account flag `ASU' will no longer be set but that makes suser()
mpsafe since it no longer mess with a per-process field.

No objection from millert@, ok tedu@, bluhm@

Revision 1.331 / (download) - annotate - [select for diffs], Tue Jan 2 06:38:45 2018 UTC (6 years, 5 months ago) by guenther
Branch: MAIN
Changes since 1.330: +2 -1 lines
Diff to previous 1.330 (colored)

Stop assuming <sys/file.h> will pull in fcntl.h when _KERNEL is defined.

ok millert@ sthen@

Revision 1.330 / (download) - annotate - [select for diffs], Fri Aug 11 21:24:19 2017 UTC (6 years, 10 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.329: +3 -4 lines
Diff to previous 1.329 (colored)

Remove NET_LOCK()'s argument.

Tested by Hrvoje Popovski, ok bluhm@

Revision 1.329 / (download) - annotate - [select for diffs], Tue Jun 20 14:11:46 2017 UTC (6 years, 11 months ago) by gerhard
Branch: MAIN
Changes since 1.328: +2 -1 lines
Diff to previous 1.328 (colored)

Do not touch file pointers for which FILE_IS_USABLE() is false.
They're might not be fully constructed.

ok mpi@ deraadt@ bluhm@

Revision 1.328 / (download) - annotate - [select for diffs], Wed Jun 14 03:00:40 2017 UTC (6 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.327: +6 -5 lines
Diff to previous 1.327 (colored)

tweak sysctl_string and sysctl_tstring to use size_t for lengths, not int

theyre both wrappers around sysctl__string, which is where half the
fix is too.

Revision 1.327 / (download) - annotate - [select for diffs], Tue Jun 13 06:16:31 2017 UTC (7 years ago) by dlg
Branch: MAIN
Changes since 1.326: +5 -4 lines
Diff to previous 1.326 (colored)

use size_t for the size of things in memory, not int.

this tweaks the len argument to sysctl_rdstring, sysctl_struct, and
sysctl_rdstruct.

there's probably more to fix.

ok millert@

Revision 1.326 / (download) - annotate - [select for diffs], Sat May 6 18:18:11 2017 UTC (7 years, 1 month ago) by bluhm
Branch: MAIN
Changes since 1.325: +3 -2 lines
Diff to previous 1.325 (colored)

Do not export the protocol PCB pointer from kernel to non-root users
also in the IPv6 case.  This fixes "netstat -An -f inet6 -p tcp"
and shows 0x0.
report and OK dhill@

Revision 1.325 / (download) - annotate - [select for diffs], Thu Apr 27 21:39:27 2017 UTC (7 years, 1 month ago) by bluhm
Branch: MAIN
Changes since 1.324: +21 -5 lines
Diff to previous 1.324 (colored)

Enforce that sysctl kern.somaxconn and sominconn can only be set
to valid values.  The so_qlimit is type short.
report Dillon Jay Pena; OK deraadt@

Revision 1.324 / (download) - annotate - [select for diffs], Wed Apr 5 04:15:44 2017 UTC (7 years, 2 months ago) by guenther
Branch: MAIN
Changes since 1.323: +2 -1 lines
Diff to previous 1.323 (colored)

timeval has trailing padding on powerpc and m88k, so memset it before
copyout to avoid leaking kernel stack

ok deraadt@

Revision 1.323 / (download) - annotate - [select for diffs], Wed Apr 5 04:00:41 2017 UTC (7 years, 2 months ago) by deraadt
Branch: MAIN
Changes since 1.322: +3 -3 lines
Diff to previous 1.322 (colored)

Here at OpenBSD we change ABIs at the fling of a hat.  Just in case a
future disk info sysctl has pads in the structures, use M_ZERO when
allocating the storage to avoid leaking kernel memory.

Revision 1.322 / (download) - annotate - [select for diffs], Tue Mar 7 09:29:40 2017 UTC (7 years, 3 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.321: +3 -3 lines
Diff to previous 1.321 (colored)

Enforce that tcbtable and udbtable must be accessed with the NET_LOCK().

Get rid of the old splnet()/splx() dances.  What's protecting them right
now is the KERNEL_LOCK().  but since pf(4) look at these tables we want
to protect them in another way, hence the NET_LOCK(), at least as hint.

ok bluhm@

Revision 1.321 / (download) - annotate - [select for diffs], Sat Jan 21 05:42:03 2017 UTC (7 years, 4 months ago) by guenther
Branch: MAIN
Changes since 1.320: +2 -3 lines
Diff to previous 1.320 (colored)

p_comm is the process's command and isn't per thread, so move it from
struct proc to struct process.

ok deraadt@ kettenis@

Revision 1.320 / (download) - annotate - [select for diffs], Fri Nov 11 18:59:09 2016 UTC (7 years, 7 months ago) by mikeb
Branch: MAIN
Changes since 1.319: +2 -2 lines
Diff to previous 1.319 (colored)

Export p_cpuid via sysctl for all processes;  ok guenther

Revision 1.319 / (download) - annotate - [select for diffs], Mon Nov 7 00:26:32 2016 UTC (7 years, 7 months ago) by guenther
Branch: MAIN
Changes since 1.318: +2 -3 lines
Diff to previous 1.318 (colored)

Split PID from TID, giving processes a PID unrelated to the TID of their
initial thread

ok jsing@ kettenis@

Revision 1.318 / (download) - annotate - [select for diffs], Mon Oct 24 04:38:44 2016 UTC (7 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.317: +20 -4 lines
Diff to previous 1.317 (colored)

move the mbstat structure to percpu counters

each cpus counters still have to be protected by splnet, but this
is better thana single set of counters protected by a global mutex.

ok bluhm@

Revision 1.317 / (download) - annotate - [select for diffs], Sat Oct 22 04:39:18 2016 UTC (7 years, 7 months ago) by guenther
Branch: MAIN
Changes since 1.316: +5 -4 lines
Diff to previous 1.316 (colored)

Factor out pr->ps_vmspace into a local variable for fill_kproc()

ok jsing@ kettenis@

Revision 1.316 / (download) - annotate - [select for diffs], Sat Oct 8 21:31:56 2016 UTC (7 years, 8 months ago) by tedu
Branch: MAIN
Changes since 1.315: +2 -2 lines
Diff to previous 1.315 (colored)

upon further review, port numbers go all the way up to ushort max

Revision 1.315 / (download) - annotate - [select for diffs], Sat Oct 8 21:27:32 2016 UTC (7 years, 8 months ago) by tedu
Branch: MAIN
Changes since 1.314: +2 -2 lines
Diff to previous 1.314 (colored)

initialize the port variable before sysctl, since it's also read out.

Revision 1.314 / (download) - annotate - [select for diffs], Fri Oct 7 19:04:44 2016 UTC (7 years, 8 months ago) by tedu
Branch: MAIN
Changes since 1.313: +11 -1 lines
Diff to previous 1.313 (colored)

introduce a sysctl to hijack dns sockets. when set to a port number,
all dns socket connections will be redirected to localhost:port.
this could be a sockopt on the listening socket, but sysctl is
an easier interface to work with right now.
ok deraadt

Revision 1.313 / (download) - annotate - [select for diffs], Sun Oct 2 23:11:55 2016 UTC (7 years, 8 months ago) by guenther
Branch: MAIN
Changes since 1.312: +2 -1 lines
Diff to previous 1.312 (colored)

Add va_nlink information to struct kinfo_file (so bump the shlib minor)

from Sebastien Marie

Revision 1.312 / (download) - annotate - [select for diffs], Sun Sep 25 15:23:37 2016 UTC (7 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.311: +9 -1 lines
Diff to previous 1.311 (colored)

Make a move towards ending 4 decades of kernel snooping.

Add sysctl kern.allowkmem (default 0) which controls the ability to open
/dev/mem or /dev/kmem at securelevel > 0.  Over 15 years we converted 99%
of utilities in the tree to operate on sysctl-nodes (either by themselves
or via code hiding in the guts of -lkvm).

pstat -d and -v & procmap are affected and continued use of them will
require kern.allowkmem=1 in /etc/sysctl.conf.  acpidump (and it's
buddy sendbug) are affected, but we'll work out a solution soon.

There will be some impact in ports.

ok kettenis guenther

Revision 1.311 / (download) - annotate - [select for diffs], Wed Sep 21 14:06:50 2016 UTC (7 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.310: +1 -14 lines
Diff to previous 1.310 (colored)

sysctl KERN_ARND is no longer used (in ports, it only occurs in fallback
paths of libevent).  This interface was the first generation of what
eventually became getentropy(2) and arc4random(3) -- june 1997!
Ports scan by sthen, general agreement guenther

Revision 1.310 / (download) - annotate - [select for diffs], Sun Sep 18 14:32:54 2016 UTC (7 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.309: +1 -5 lines
Diff to previous 1.309 (colored)

option INSECURE is obsolete

Revision 1.309 / (download) - annotate - [select for diffs], Wed Sep 7 17:30:12 2016 UTC (7 years, 9 months ago) by natano
Branch: MAIN
Changes since 1.308: +1 -5 lines
Diff to previous 1.308 (colored)

Remove usermount remnants. ok tedu

Revision 1.308 / (download) - annotate - [select for diffs], Sun Sep 4 09:22:29 2016 UTC (7 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.307: +2 -2 lines
Diff to previous 1.307 (colored)

Introduce Dynamic Profiling, a ddb(4) based & gprof compatible kernel
profiling framework.

Code patching is used to enable probes when entering functions.  The
probes will call a mcount()-like function to match the behavior of a
GPROF kernel.

Currently only available on amd64 and guarded under DDBPROF.  Support
for other archs will follow soon.

A new sysctl knob, ddb.console, need to be set to 1 in securelevel 0
to be able to use this feature.

Inputs and ok guenther@

Revision 1.307 / (download) - annotate - [select for diffs], Tue Aug 23 23:28:02 2016 UTC (7 years, 9 months ago) by tedu
Branch: MAIN
Changes since 1.306: +2 -2 lines
Diff to previous 1.306 (colored)

rename nfiles to numfiles to avoid shadowing and stretch out the name.
ok deraadt

Revision 1.306 / (download) - annotate - [select for diffs], Thu Jul 14 15:39:40 2016 UTC (7 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.305: +6 -4 lines
Diff to previous 1.305 (colored)

kern.usermount=1 is unsafe for everyone, since it allows any non-pledged
program to call the mount/umount system calls.  There is no way any user
can be expected to keep their system safe / reliable with this feature.
Ignore setting to =1, and after release we'll delete the sysctl entirely.
ok lots of people

Revision 1.305 / (download) - annotate - [select for diffs], Fri May 27 19:45:04 2016 UTC (8 years ago) by deraadt
Branch: MAIN
Changes since 1.304: +4 -1 lines
Diff to previous 1.304 (colored)

W^X violations are no longer permitted by default.  A kernel log message
is generated, and mprotect/mmap return ENOTSUP.  If the sysctl(8) flag
kern.wxabort is set then a SIGABRT occurs instead, for gdb use or coredump
creation.

W^X violating programs can be permitted on a ffs/nfs filesystem-basis,
using the "wxallowed" mount option.  One day far in the future
upstream software developers will understand that W^X violations are a
tremendously risky practice and that style of programming will be
banished outright.  Until then, we recommend most users need to use the
wxallowed option on their /usr/local filesystem.  At least your other
filesystems don't permit such programs.

ok jca kettenis mlarkin natano

Revision 1.304 / (download) - annotate - [select for diffs], Mon May 23 15:59:19 2016 UTC (8 years ago) by deraadt
Branch: MAIN
Changes since 1.303: +1 -4 lines
Diff to previous 1.303 (colored)

remove the sysctl kern.random counters, since none of the remaining
ones are capable of giving valuable works vs does-not-work evidence.
ok tedu

Revision 1.303 / (download) - annotate - [select for diffs], Sat May 21 14:00:27 2016 UTC (8 years ago) by jsing
Branch: MAIN
Changes since 1.302: +7 -15 lines
Diff to previous 1.302 (colored)

Cleanup some of the DUID code and refactor for readability.

ok krw@ kettenis@

Revision 1.302 / (download) - annotate - [select for diffs], Wed May 4 01:28:42 2016 UTC (8 years, 1 month ago) by zhuk
Branch: MAIN
Changes since 1.301: +6 -2 lines
Diff to previous 1.301 (colored)

Make KERN_FILE_BYPID return ESRCH when PID not found, both in sysctl and
offline paths. More polishing to come.

Input and okay bluhm@ & kettenis@.

Revision 1.301 / (download) - annotate - [select for diffs], Mon Apr 25 20:00:33 2016 UTC (8 years, 1 month ago) by tedu
Branch: MAIN
Changes since 1.300: +1 -8 lines
Diff to previous 1.300 (colored)

boom goes the dynamite

Revision 1.300 / (download) - annotate - [select for diffs], Mon Feb 29 19:44:07 2016 UTC (8 years, 3 months ago) by naddy
Branch: MAIN
Changes since 1.299: +1 -41 lines
Diff to previous 1.299 (colored)

delete the kern.emul/KERN_EMUL sysctl bits since there are no
emulations left; ok millert@ deraadt@, jmc@ (man pages)

Revision 1.299 / (download) - annotate - [select for diffs], Sat Dec 5 20:54:34 2015 UTC (8 years, 6 months ago) by kettenis
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.298: +6 -6 lines
Diff to previous 1.298 (colored)

Make sure we use the same cpu numbering for the kern.cptime2 sysctl as we
do for kern.proc.  Fixes the issue in top(1) where a cpu would seem to be idle
even though a thread was reported to be running on it.

ok mpi@, tedu@, deraadt@

Revision 1.298 / (download) - annotate - [select for diffs], Sun Nov 1 19:03:33 2015 UTC (8 years, 7 months ago) by semarie
Branch: MAIN
Changes since 1.297: +3 -3 lines
Diff to previous 1.297 (colored)

refactor pledge_*_check and pledge_fail functions

- rename _check function without suffix: a "pledge" function called from
  anywhere is a "check" function.

- makes pledge_fail call the responsability to the _check function. remove it
  from caller.

- make proper use of (potential) returned error of _check() functions.

- adds pledge_kill() and pledge_protexec()

with and OK deraadt@

Revision 1.297 / (download) - annotate - [select for diffs], Sun Oct 25 20:39:54 2015 UTC (8 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.296: +5 -3 lines
Diff to previous 1.296 (colored)

Fold "malloc" into "stdio" and -- recognizing that no program so far has
used less than "stdio" -- include all the "self" operations.  Instead of
different defines, use regular PLEDGE_* in the "p_pledgenote" variable
(which indicates the operation subtype a system call is performing).  Many
checks before easier to understand.  p_pledgenote can often be passed
directly to ktrace, so that kdump says:
 15565 test     CALL  pledge(0xa9a3f804c51,0)
 15565 test     STRU  pledge request="stdio"
 15565 test     RET   pledge 0
 15565 test     CALL  open(0xa9a3f804c57,0x2<O_RDWR>)
 15565 test     NAMI  "/tmp/testfile"
 15565 test     PLDG  open, "wpath", errno 1 Operation not permitted
with help from semarie, ok guenther

Revision 1.296 / (download) - annotate - [select for diffs], Fri Oct 9 01:10:27 2015 UTC (8 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.295: +4 -4 lines
Diff to previous 1.295 (colored)

Rename tame() to pledge().  This fairly interface has evolved to be more
strict than anticipated.  It allows a programmer to pledge/promise/covenant
that their program will operate within an easily defined subset of the
Unix environment, or it pays the price.

Revision 1.295 / (download) - annotate - [select for diffs], Mon Sep 28 16:59:35 2015 UTC (8 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.294: +7 -3 lines
Diff to previous 1.294 (colored)

track sizes for free in sysctl_diskinit(); ok krw

Revision 1.294 / (download) - annotate - [select for diffs], Sun Sep 13 17:08:03 2015 UTC (8 years, 8 months ago) by guenther
Branch: MAIN
Changes since 1.293: +3 -3 lines
Diff to previous 1.293 (colored)

Rename __sysctl syscall to just sysctl, as the userland wrapper is no longer
necessary

ok deraadt@ jsing@

Revision 1.293 / (download) - annotate - [select for diffs], Fri Sep 11 15:29:47 2015 UTC (8 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.292: +2 -2 lines
Diff to previous 1.292 (colored)

Convert _TM_ flags to TAME_ flags, collapsing the entire mapping
layer because the strings select the right options.  Mechanical
conversion.
ok guenther

Revision 1.292 / (download) - annotate - [select for diffs], Fri Sep 11 08:22:31 2015 UTC (8 years, 9 months ago) by guenther
Branch: MAIN
Changes since 1.291: +2 -1 lines
Diff to previous 1.291 (colored)

Only include <sys/tame.h> in the .c files that need it

ok deraadt@ miod@

Revision 1.291 / (download) - annotate - [select for diffs], Thu Sep 10 18:10:35 2015 UTC (8 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.290: +5 -4 lines
Diff to previous 1.290 (colored)

sizes for free(); ok sthen

Revision 1.290 / (download) - annotate - [select for diffs], Thu Sep 3 12:13:13 2015 UTC (8 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.289: +5 -2 lines
Diff to previous 1.289 (colored)

Fix !INET6 build.

Revision 1.289 / (download) - annotate - [select for diffs], Fri Aug 28 04:38:47 2015 UTC (8 years, 9 months ago) by guenther
Branch: MAIN
Changes since 1.288: +2 -2 lines
Diff to previous 1.288 (colored)

Rework the UNIX domain socket garbage collector, including ideas from
{Free,Net}BSD
 - when a socket is closed with fds in its input, defer closing them to
   a task to avoid recursing.  This eliminates the complicated extra
   reference taking which had a 37 line(!) comment explanation
 - move flags, counts, and links only needed for this from struct file to
   struct unpcb
 - document the flow of the mark/sweep collector

much help from claudio@ who made me explain the GC to him until we trusted it
ok claudio@ mpi@ deraadt@

Revision 1.288 / (download) - annotate - [select for diffs], Sat Aug 22 20:18:49 2015 UTC (8 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.287: +1 -2 lines
Diff to previous 1.287 (colored)

Move to tame(int flags, char *paths[]) API/ABI.

The pathlist is a whitelist of dirs and files; anything else returns ENOENT.
Recommendation is to use a narrowly defined list.  Also add TAME_FATTR, which
permits explicit change operations against "struct stat" fields.  Some
other TAME_ flags are refined slightly.

Not cranking libc now, since nothing commited in base uses this and the
timing is uncomfortable for others.  Discussed with many; thanks for a
few bug fixes from semarie, doug, guenther.
ok guenther

Revision 1.287 / (download) - annotate - [select for diffs], Mon Aug 3 14:20:39 2015 UTC (8 years, 10 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.286: +59 -19 lines
Diff to previous 1.286 (colored)

Unfortunately netstat did not show sockets without file descriptors
since it had been converted from kvm to sysctl.  This was hiding a
bunch of TCP states which are important for network debugging.
Loop over the internet PCB tables to fill the network information
into the KERN_FILE_BYFILE sysctl result.  Skip internet sockets
when looping over the file desciptors.
From markus@; OK guenther@; Go for it deraadt@

Revision 1.286 / (download) - annotate - [select for diffs], Sun Jul 19 02:35:35 2015 UTC (8 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.285: +5 -1 lines
Diff to previous 1.285 (colored)

tame(2) is a subsystem which restricts programs into a "reduced feature
operating model".  This is the kernel component; various changes should
proceed in-tree for a while before userland programs start using it.
ok miod, discussions and help from many

Revision 1.285 / (download) - annotate - [select for diffs], Mon May 18 19:10:35 2015 UTC (9 years ago) by bluhm
Branch: MAIN
Changes since 1.284: +21 -9 lines
Diff to previous 1.284 (colored)

For each file in sysctl(KERN_FILE_BYFILE), FILLIT() calls fill_file(),
which calls VOP_GETATTR().  For NFS, that leads to nfs_getattr().
If the node's attributes are not in NFS's cache, nfs_getattr() will
invoke nfs_request() and the latter will sleep, allowing the file
pointer to disappear while we traverse the list.
This results in kernel crashes while running netstat or pstat -f.
Grab a reference to the file descriptor before calling FILLIT(),
and release it afterwards.  This way the file descriptor cannot
disappear while we sleep in nfs_getattr().
Analysis and fix from Pedro Martelletto; input and OK guenther@ mpi@

Revision 1.284 / (download) - annotate - [select for diffs], Sat Mar 28 23:50:55 2015 UTC (9 years, 2 months ago) by bluhm
Branch: MAIN
Changes since 1.283: +5 -3 lines
Diff to previous 1.283 (colored)

Replace the hand-crafted list of datagram unix domain sockets with
a SLIST.
OK mpi@ benno@

Revision 1.283 / (download) - annotate - [select for diffs], Wed Feb 11 05:09:33 2015 UTC (9 years, 4 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.282: +21 -1 lines
Diff to previous 1.282 (colored)

Extend struct kinfo_file a bit so that netstat has all the info it needs.
OK guenther@

Revision 1.282 / (download) - annotate - [select for diffs], Wed Feb 11 04:00:05 2015 UTC (9 years, 4 months ago) by guenther
Branch: MAIN
Changes since 1.281: +2 -2 lines
Diff to previous 1.281 (colored)

Prefer arg != 0 over arg for non-boolean.  nitted kettenis@

Revision 1.281 / (download) - annotate - [select for diffs], Wed Feb 11 03:03:08 2015 UTC (9 years, 4 months ago) by guenther
Branch: MAIN
Changes since 1.280: +3 -6 lines
Diff to previous 1.280 (colored)

sysctl({CTL_KERN, KERN_FILE, KERN_FILE_BYFILE}) previously required
the extra argument to be zero; instead, make it filter on the file
type (DTYPE_*) when non-zero to make claudio's netstat work easier.

ok claudio@

Revision 1.280 / (download) - annotate - [select for diffs], Mon Feb 9 11:52:47 2015 UTC (9 years, 4 months ago) by miod
Branch: MAIN
Changes since 1.279: +1 -2 lines
Diff to previous 1.279 (colored)

Change the way stackgap_random is applied. Instead of applying it within the
fixed stack area of the exec'd image, and risking hitting process limits,
should we want to increase stackgap_random, the randomness is applied to the
stack region in the process' vmspace.

Revision 1.279 / (download) - annotate - [select for diffs], Tue Jan 20 19:43:21 2015 UTC (9 years, 4 months ago) by kettenis
Branch: MAIN
Changes since 1.278: +5 -3 lines
Diff to previous 1.278 (colored)

Move ps_strings "after" the random stackgap.  This makes its location a
per-process value, and therefpore turns the VM_PSSTRINGS sysctl into a
per-process one as well.  This gets rid of a pointer to the bottom of the
stack at a fixed location.  Also clears the road for unmapping the stackgap.

ok deraadt@

Revision 1.278 / (download) - annotate - [select for diffs], Tue Jan 13 10:07:58 2015 UTC (9 years, 4 months ago) by mpf
Branch: MAIN
Changes since 1.277: +18 -7 lines
Diff to previous 1.277 (colored)

Add dmesg -s support, to view the output of rc(8) system startup messages.
Help and feedback by Theo and Miod.
OK deraadt@, manpage-ok jmc@

Revision 1.277 / (download) - annotate - [select for diffs], Fri Dec 12 07:45:46 2014 UTC (9 years, 6 months ago) by tedu
Branch: MAIN
Changes since 1.276: +8 -1 lines
Diff to previous 1.276 (colored)

sysctl kern.global_ptrace.
controls whether you can ptrace any process with appropriate privileges
or only one own's children.
ok deraadt

Revision 1.276 / (download) - annotate - [select for diffs], Fri Dec 12 03:04:11 2014 UTC (9 years, 6 months ago) by uebayasi
Branch: MAIN
Changes since 1.275: +11 -7 lines
Diff to previous 1.275 (colored)

sysctl_proc_vmmap(): Allow retrieving "self" VM mapping without privilege.

Previous version OK'ed by tedu@ deraadt@

Revision 1.275 / (download) - annotate - [select for diffs], Wed Dec 10 02:44:47 2014 UTC (9 years, 6 months ago) by tedu
Branch: MAIN
Changes since 1.274: +3 -3 lines
Diff to previous 1.274 (colored)

convert bcopy to memcpy. ok millert

Revision 1.274 / (download) - annotate - [select for diffs], Fri Dec 5 04:35:08 2014 UTC (9 years, 6 months ago) by uebayasi
Branch: MAIN
Changes since 1.273: +5 -0 lines
Diff to previous 1.273 (colored)

Allow only root to use KERN_PROC_VMMAP until it is really proven safe.

OK deraadt@

Revision 1.273 / (download) - annotate - [select for diffs], Fri Dec 5 04:12:48 2014 UTC (9 years, 6 months ago) by uebayasi
Branch: MAIN
Changes since 1.272: +101 -1 lines
Diff to previous 1.272 (colored)

Introduce a new sysctl to retrieve VM map entries

This adds a new sysctl KERN_PROC_VMMAP, which returns an array of VM map
entries of a specified process.  This prevents debuggers from iterating
vm_map_entry RB tree via kvm(3).

The name KERN_PROC_VMMAP and struct kinfo_vmentry are chosen from the same
function in FreeBSD.  struct kinfo_vmentry is revised to reduce size, because
OpenBSD does not keep track of filepaths.  The semantic is also changed to
return max buffer size as a hint, and start iteration at the specified base
address.

Much valuable input from deraadt@, guenther@, tedu@

OK tedu@ deraadt@

Revision 1.272 / (download) - annotate - [select for diffs], Wed Nov 19 21:17:37 2014 UTC (9 years, 6 months ago) by tedu
Branch: MAIN
Changes since 1.271: +1 -3 lines
Diff to previous 1.271 (colored)

missed a file when removing KERN_VNODE.

Revision 1.271 / (download) - annotate - [select for diffs], Wed Nov 19 18:04:54 2014 UTC (9 years, 6 months ago) by tedu
Branch: MAIN
Changes since 1.270: +1 -3 lines
Diff to previous 1.270 (colored)

delete the KERN_VNODE sysctl. it fails to provide any isolation from the
kernel struct vnode defintion, and the only consumer (pstat) still needs
kvm to read much of the required information. no great loss to always use
kvm until there's a better replacement interface.
ok deraadt millert uebayasi

Revision 1.270 / (download) - annotate - [select for diffs], Sun Nov 16 12:31:00 2014 UTC (9 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.269: +2 -2 lines
Diff to previous 1.269 (colored)

Replace a plethora of historical protection options with just
PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h.
PROT_MASK is introduced as the one true way of extracting those bits.
Remove UVM_ADV_* wrapper, using the standard names.
ok doug guenther kettenis

Revision 1.269 / (download) - annotate - [select for diffs], Mon Nov 3 17:20:46 2014 UTC (9 years, 7 months ago) by bluhm
Branch: MAIN
Changes since 1.268: +6 -5 lines
Diff to previous 1.268 (colored)

Put the socket splicing fields into a seperate struct sosplice that
gets only allocated when needed.  This way struct socket shrinks
from 472 to 392 bytes on amd64.  When splicing gets active, another
88 bytes are allocated for struct sosplice.
OK dlg@

Revision 1.268 / (download) - annotate - [select for diffs], Sat Nov 1 23:58:28 2014 UTC (9 years, 7 months ago) by tedu
Branch: MAIN
Changes since 1.267: +7 -7 lines
Diff to previous 1.267 (colored)

add a few sizes to free

Revision 1.267 / (download) - annotate - [select for diffs], Fri Oct 17 01:51:39 2014 UTC (9 years, 7 months ago) by tedu
Branch: MAIN
Changes since 1.266: +9 -20 lines
Diff to previous 1.266 (colored)

redo the performance throttling in the kernel.
introduce a new sysctl, hw.perfpolicy, that governs the policy.
when set to anything other than manual, hw.setperf then becomes read only.
phessler was heading in this direction, but this is slightly different. :)

Revision 1.266 / (download) - annotate - [select for diffs], Sat Oct 11 17:12:30 2014 UTC (9 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.265: +8 -82 lines
Diff to previous 1.265 (colored)

back out; does not even compile

Revision 1.265 / (download) - annotate - [select for diffs], Sat Oct 11 16:28:06 2014 UTC (9 years, 8 months ago) by tedu
Branch: MAIN
Changes since 1.264: +83 -9 lines
Diff to previous 1.264 (colored)

resurrect a many year old diff. move CPU throttling into the kernel,
enabled by setting hw.setperf=-1. some other bugs preventing this from
going in before have been fixed. my thanks to phessler for keeping the
diff alive in the mean time. tested by several to not regress.

Revision 1.264 / (download) - annotate - [select for diffs], Mon Sep 15 19:08:21 2014 UTC (9 years, 8 months ago) by miod
Branch: MAIN
Changes since 1.263: +2 -3 lines
Diff to previous 1.263 (colored)

Remove non-standard <sys/dkstat.h> header. It has not contained anything
related to disk stastics for almost 17 years, and the remaining
userland-visible defines duplicate those found in <sys/sched.h>.

Move the remaining _KERNEL defines to <sys/tty.h> where they belong, and
update all users to cope with this.

ok kettenis@

Revision 1.263 / (download) - annotate - [select for diffs], Thu Sep 4 19:14:47 2014 UTC (9 years, 9 months ago) by miod
Branch: MAIN
Changes since 1.262: +2 -2 lines
Diff to previous 1.262 (colored)

Remove global cp_time[] array; no longer used now that all arches implement
cpu_info.

Revision 1.262 / (download) - annotate - [select for diffs], Wed Aug 20 06:23:03 2014 UTC (9 years, 9 months ago) by mikeb
Branch: MAIN
Changes since 1.261: +1 -16 lines
Diff to previous 1.261 (colored)

Bye bye /dev/crypto

The interface has been disabled by default for about 4 years and
currently there's not much value in having it around at all.

ok deraadt

Revision 1.261 / (download) - annotate - [select for diffs], Mon Aug 18 05:11:03 2014 UTC (9 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.260: +2 -1 lines
Diff to previous 1.260 (colored)

dont rely on mbuf.h to provide pool.h.

ok miod@, who has offerred to help with any MD fallout
ok guenther@

Revision 1.260 / (download) - annotate - [select for diffs], Tue Jul 22 11:06:09 2014 UTC (9 years, 10 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.259: +1 -2 lines
Diff to previous 1.259 (colored)

Fewer <netinet/in_systm.h> !

Revision 1.259 / (download) - annotate - [select for diffs], Thu Jul 17 13:44:21 2014 UTC (9 years, 10 months ago) by tedu
Branch: MAIN
Changes since 1.258: +2 -1 lines
Diff to previous 1.258 (colored)

zero random buf for sysctl too, just in case

Revision 1.258 / (download) - annotate - [select for diffs], Sun Jul 13 16:41:21 2014 UTC (9 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.257: +48 -1 lines
Diff to previous 1.257 (colored)

Introduce PS_NOBROADCASTKILL a process flag that excludes processes from
receiving broadcast signals (kill -1). The flag can be set via a new
sysctl KERN_PROC_NOBROADCASTKILL. This will be used by iscsid to survive
the mass killing by init(8) when terminating multi-user operations.
With and OK guenther@

Revision 1.257 / (download) - annotate - [select for diffs], Sun Jul 13 15:29:04 2014 UTC (9 years, 11 months ago) by tedu
Branch: MAIN
Changes since 1.256: +2 -2 lines
Diff to previous 1.256 (colored)

use mallocarray where arguments are multipled. ok deraadt

Revision 1.256 / (download) - annotate - [select for diffs], Sat Jul 12 18:43:32 2014 UTC (9 years, 11 months ago) by tedu
Branch: MAIN
Changes since 1.255: +10 -10 lines
Diff to previous 1.255 (colored)

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.

Revision 1.255 / (download) - annotate - [select for diffs], Tue Jul 8 17:19:25 2014 UTC (9 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.254: +1 -2 lines
Diff to previous 1.254 (colored)

decouple struct uvmexp into a new file, so that uvm_extern.h and sysctl.h
don't need to be married.
ok guenther miod beck jsing kettenis

Revision 1.254 / (download) - annotate - [select for diffs], Tue Jul 8 07:10:12 2014 UTC (9 years, 11 months ago) by dlg
Branch: MAIN
Changes since 1.253: +3 -3 lines
Diff to previous 1.253 (colored)

pull the rx ring accounting out of the mbuf layer now that its all done
via if_rxring things. this effectively deprecates the third argument
for MCLGETI and m_clget and makes the mbuf layer no longer care about
interfaces and simplifies the allocation paths.

the timeout used to measure livelock has been moved to net/if.c.

ok mpi@

Revision 1.253 / (download) - annotate - [select for diffs], Fri Jul 4 05:58:31 2014 UTC (9 years, 11 months ago) by guenther
Branch: MAIN
Changes since 1.252: +59 -50 lines
Diff to previous 1.252 (colored)

Track whether a process is a zombie or not yet fully built via flags
PS_{ZOMBIE,EMBRYO} on the process instead of peeking into the process's
thread data.  This eliminates the need for the thread-level SDEAD state.

Change kvm_getprocs() (both the sysctl() and kvm backends) to report the
"most active" scheduler state for the process's threads.

tweaks kettenis@
feedback and ok matthew@

Revision 1.252 / (download) - annotate - [select for diffs], Sat Jun 14 22:00:28 2014 UTC (9 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.251: +2 -2 lines
Diff to previous 1.251 (colored)

Rather than truncating KERN_ARND requests silently, return EINVAL
ok miod

Revision 1.251 / (download) - annotate - [select for diffs], Sat Jun 14 21:59:38 2014 UTC (9 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.250: +2 -2 lines
Diff to previous 1.250 (colored)

temporarily (maybe 3 weeks?) crank KERN_ARND maximum buffer from 256
to 512, to make it easier for people to build to -current.
ok miod

Revision 1.250 / (download) - annotate - [select for diffs], Wed Jun 11 17:32:59 2014 UTC (10 years ago) by matthew
Branch: MAIN
Changes since 1.249: +3 -1 lines
Diff to previous 1.249 (colored)

Add bounds checks for CTL_DEBUG sysctl variable.

Revision 1.249 / (download) - annotate - [select for diffs], Sat May 17 17:26:24 2014 UTC (10 years ago) by guenther
Branch: MAIN
Changes since 1.248: +21 -21 lines
Diff to previous 1.248 (colored)

When looking at another process, use the data from struct process
instead of peeking into the thread level

ok tedu@

Revision 1.248 / (download) - annotate - [select for diffs], Sun May 4 05:03:26 2014 UTC (10 years, 1 month ago) by guenther
Branch: MAIN
Changes since 1.247: +9 -15 lines
Diff to previous 1.247 (colored)

Add PS_SYSTEM, the process-level mirror of the thread-level P_SYSTEM,
and FORK_SYSTEM as a flag to set them.  This eliminates needing to
peek into other processes threads in various places.  Inspired by NetBSD

ok miod@ matthew@

Revision 1.247 / (download) - annotate - [select for diffs], Sat May 3 23:30:04 2014 UTC (10 years, 1 month ago) by guenther
Branch: MAIN
Changes since 1.246: +8 -8 lines
Diff to previous 1.246 (colored)

If P_ZOMBIE(pr->ps_mainproc) is true, then (pr->ps_flags & PS_EXITING)
is, so eliminate the check of the former and instead use the EINVAL
error for the latter.  Also, consistently check for PS_EXITING
before check creds.

suggestion to split this from another diff miod@

Revision 1.246 / (download) - annotate - [select for diffs], Sun Mar 30 21:54:48 2014 UTC (10 years, 2 months ago) by guenther
Branch: MAIN
Changes since 1.245: +4 -4 lines
Diff to previous 1.245 (colored)

Eliminates struct pcred by moving the real and saved ugids into
struct ucred; struct process then directly links to the ucred

Based on a discussion at c2k10 or so before noting that FreeBSD and
NetBSD did this too.

ok matthew@

Revision 1.245 / (download) - annotate - [select for diffs], Sat Mar 22 06:05:45 2014 UTC (10 years, 2 months ago) by guenther
Branch: MAIN
Changes since 1.244: +2 -2 lines
Diff to previous 1.244 (colored)

Move p_sigacts from struct proc to struct process.

testing help mpi@

Revision 1.244 / (download) - annotate - [select for diffs], Tue Jan 21 01:48:44 2014 UTC (10 years, 4 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.243: +6 -6 lines
Diff to previous 1.243 (colored)

bzero -> memset

Revision 1.243 / (download) - annotate - [select for diffs], Mon Jan 20 21:19:28 2014 UTC (10 years, 4 months ago) by guenther
Branch: MAIN
Changes since 1.242: +51 -48 lines
Diff to previous 1.242 (colored)

Threads can't be zombies, only processes, so change zombproc to zombprocess,
make it a list of processes, and change P_NOZOMBIE and P_STOPPED from thread
flags to process flags.  Add allprocess list for the code that just wants
to see processes.

ok tedu@

Revision 1.242 / (download) - annotate - [select for diffs], Mon Jan 20 03:23:42 2014 UTC (10 years, 4 months ago) by guenther
Branch: MAIN
Changes since 1.241: +3 -3 lines
Diff to previous 1.241 (colored)

Move p_textvp from struct proc to struct process so that the exit code
can be further simplified.

ok kettenis@

Revision 1.241 / (download) - annotate - [select for diffs], Tue Oct 22 16:40:26 2013 UTC (10 years, 7 months ago) by guenther
Branch: MAIN
Changes since 1.240: +27 -76 lines
Diff to previous 1.240 (colored)

- add UNIX-domain socket info to struct kinfo_file2
- convert netstat from kvm_getfiles() to kvm_getfile2() using that
- delete kvm_getfiles() and KERN_FILE as no longer used (bump libkvm's major)
- rename kvm_getfile2() to kvm_getfiles(), kinfo_file2 to kinfo_file
  and KERN_FILE2 to KERN_FILE.

ok deraadt@, millert@
ports scan sthen@

Revision 1.240 / (download) - annotate - [select for diffs], Tue Jul 9 15:37:43 2013 UTC (10 years, 11 months ago) by beck
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.239: +5 -8 lines
Diff to previous 1.239 (colored)

back out the cache flipper temporarily to work out of tree.
will come back soon.
ok deraadt@

Revision 1.239 / (download) - annotate - [select for diffs], Thu Jun 13 15:00:04 2013 UTC (11 years ago) by tedu
Branch: MAIN
Changes since 1.238: +5 -5 lines
Diff to previous 1.238 (colored)

beck would prefer to keep things just as they were for a while longer.
undo style changes.

Revision 1.238 / (download) - annotate - [select for diffs], Tue Jun 11 21:51:55 2013 UTC (11 years ago) by tedu
Branch: MAIN
Changes since 1.237: +5 -5 lines
Diff to previous 1.237 (colored)

sprinkle knf fairy dust over new buf code

Revision 1.237 / (download) - annotate - [select for diffs], Tue Jun 11 19:01:20 2013 UTC (11 years ago) by beck
Branch: MAIN
Changes since 1.236: +8 -5 lines
Diff to previous 1.236 (colored)

High memory page flipping for the buffer cache.

This change splits the buffer cache free lists into lists of dma reachable
buffers and high memory buffers based on the ranges returned by pmemrange.
Buffers move from dma to high memory as they age, but are flipped to dma
reachable memory if IO is needed to/from and high mem buffer. The total
amount of buffers  allocated is now bufcachepercent of both the dma and
the high memory region.

This change allows the use of large buffer caches on amd64 using more than
4 GB of memory

ok tedu@ krw@ - testing by many.

Revision 1.236 / (download) - annotate - [select for diffs], Sun Jun 9 13:10:19 2013 UTC (11 years ago) by miod
Branch: MAIN
Changes since 1.235: +2 -2 lines
Diff to previous 1.235 (colored)

Constify the mib argument of sysctl().
ok matthew@ millert@

Revision 1.235 / (download) - annotate - [select for diffs], Mon Jun 3 16:55:22 2013 UTC (11 years ago) by guenther
Branch: MAIN
Changes since 1.234: +10 -8 lines
Diff to previous 1.234 (colored)

Convert some internal APIs to use timespecs instead of timevals

ok matthew@ deraadt@

Revision 1.234 / (download) - annotate - [select for diffs], Sat Apr 6 03:44:34 2013 UTC (11 years, 2 months ago) by tedu
Branch: MAIN
Changes since 1.233: +1 -6 lines
Diff to previous 1.233 (colored)

rthreads are always enabled. remove the sysctl.
ok deraadt guenther kettenis matthew

Revision 1.233 / (download) - annotate - [select for diffs], Sat Mar 23 21:22:20 2013 UTC (11 years, 2 months ago) by tedu
Branch: MAIN
Changes since 1.232: +18 -8 lines
Diff to previous 1.232 (colored)

pull the suser check for sysctl pointers up higher, out of the loops.
hide a few more pointery things.
ok deraadt

Revision 1.232 / (download) - annotate - [select for diffs], Wed Mar 20 03:43:08 2013 UTC (11 years, 2 months ago) by deraadt
Branch: MAIN
Changes since 1.231: +31 -15 lines
Diff to previous 1.231 (colored)

When non-root asks sysctl for kinfo proc or file requests, do not fill in
any kernel addresses information.
ok guenther

Revision 1.231 / (download) - annotate - [select for diffs], Mon Feb 11 11:11:42 2013 UTC (11 years, 4 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.230: +11 -2 lines
Diff to previous 1.230 (colored)

When information about threads are not requested sum the '%cpu' of
all threads in a process instead of returning only the '%cpu' for
the main thread.

This makes top(1) display the correct percentage of CPU usage for
threaded processes when theads are not displayed.

ok sthen@, mikeb@

Revision 1.230 / (download) - annotate - [select for diffs], Tue Jan 15 23:30:39 2013 UTC (11 years, 4 months ago) by jcs
Branch: MAIN
Changes since 1.229: +7 -1 lines
Diff to previous 1.229 (colored)

restrict KERN_PROC_ARGS lookup of KERN_PROC_NENV and KERN_PROC_ENV
to process owner and root

ok deraadt millert guenther

Revision 1.229 / (download) - annotate - [select for diffs], Sun Dec 30 00:58:19 2012 UTC (11 years, 5 months ago) by guenther
Branch: MAIN
Changes since 1.228: +8 -2 lines
Diff to previous 1.228 (colored)

In sysctl_proc_cwd(), vref() the target proc's fd_cdir before calling
malloc(), so that it can't exit and be freed if we sleep.

(another sparc.p nightmare test case)
ok beck@, phessler@

Revision 1.228 / (download) - annotate - [select for diffs], Mon Nov 5 19:39:35 2012 UTC (11 years, 7 months ago) by miod
Branch: MAIN
Changes since 1.227: +1 -7 lines
Diff to previous 1.227 (colored)

unifdef -D __HAVE_TIMECOUNTER

Revision 1.227 / (download) - annotate - [select for diffs], Thu Aug 30 20:11:32 2012 UTC (11 years, 9 months ago) by matthew
Branch: MAIN
Changes since 1.226: +2 -2 lines
Diff to previous 1.226 (colored)

Remove a useless test for "elem_count < 0", which can never be true
because elem_count has an unsigned type (size_t).

Noted by Brad/Clang; no binary change on amd64 using GCC either.

Revision 1.226 / (download) - annotate - [select for diffs], Sat Jun 2 05:44:27 2012 UTC (12 years ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.225: +3 -3 lines
Diff to previous 1.225 (colored)

Committed the wrong version (an earlier try) of the KERN_FILE2 vs
rthreads fix.  Update to the correct one.

Revision 1.225 / (download) - annotate - [select for diffs], Wed May 30 20:04:52 2012 UTC (12 years ago) by matthew
Branch: MAIN
Changes since 1.224: +1 -5 lines
Diff to previous 1.224 (colored)

Oops, when we moved _POSIX_SAVED_IDS from sys/unistd.h to unistd.h, it
silently changed sysctl kern.saved_ids from returning 1 to 0.

ok millert

Revision 1.224 / (download) - annotate - [select for diffs], Fri May 25 04:39:41 2012 UTC (12 years ago) by guenther
Branch: MAIN
Changes since 1.223: +11 -5 lines
Diff to previous 1.223 (colored)

Change the KERN_FILE_BYPID and KERN_FILE_BYUID modes of the KERN_FILE2
sysctl() to be per-process instead of per-thread.  This means the
filedesc table has to really be per-process instead of per-thread,
so make it an error for the linux clone() emulation to try to do
otherwise.  This removes pointless duplication in fstat's output.

requested by jsing@ and deraadt@, ok matthew@ deraadt@

Revision 1.223 / (download) - annotate - [select for diffs], Wed May 2 20:42:25 2012 UTC (12 years, 1 month ago) by guenther
Branch: MAIN
Changes since 1.222: +5 -11 lines
Diff to previous 1.222 (colored)

Oops, previous change had some unrelated changes that shouldn't have been
committed; roll them back.

Revision 1.222 / (download) - annotate - [select for diffs], Tue May 1 03:43:23 2012 UTC (12 years, 1 month ago) by guenther
Branch: MAIN
Changes since 1.221: +12 -6 lines
Diff to previous 1.221 (colored)

Eliminate the f_usecount ref count in struct file; instead of sleeping
at the top of closef() until all in-progress calls finish, just do the
advisory locking bits required of close() by POSIX and let whichever
thread has the last reference do the call to the file's fo_close()
method and the final cleanup.

lots of discussion with deraadt@ and others; worked out with and ok krw@

Revision 1.221 / (download) - annotate - [select for diffs], Tue Apr 17 23:17:53 2012 UTC (12 years, 1 month ago) by pirofti
Branch: MAIN
Changes since 1.220: +9 -1 lines
Diff to previous 1.220 (colored)

Make it optional for kvm_getprocs() (and related sysctl) to return
thread information.

Add a KERN_PROC_SHOW_THREADS flag that has to be set in order to get the
thread info and make it off by default. This creates backwards compatibility
for applications that relied on a given size/number of items to be returned.

Modify ps(1) and top(1) accordingly.

Okay guenther@.

Revision 1.220 / (download) - annotate - [select for diffs], Thu Apr 12 14:59:19 2012 UTC (12 years, 2 months ago) by pirofti
Branch: MAIN
Changes since 1.219: +16 -4 lines
Diff to previous 1.219 (colored)

Add per thread accounting, mainly for usage & friends.

This expands the already bloated FILL_KPROC macro to take an extra
parameter that indicates if the callee is a thread or a process.

The userland bits are adjusted accordingly and ps(1) and top(1) now
display per thread usage times when -H is used.

Also pkill(1) had to be adjusted so that duplicates don't pop up.

libkvm does basically the same thing as the kernel bits.

Okay guenther@.

Revision 1.219 / (download) - annotate - [select for diffs], Tue Apr 10 15:50:52 2012 UTC (12 years, 2 months ago) by guenther
Branch: MAIN
Changes since 1.218: +7 -3 lines
Diff to previous 1.218 (colored)

Make the KERN_NPROCS and KERN_MAXPROC sysctl()s and the RLIMIT_NPROC rlimit
count processes instead of threads.  New sysctl()s KERN_NTHREADS and
KERN_MAXTHREAD count and limit threads.  The nprocs and maxproc kernel
variables are replaced by nprocess, maxprocess, nthreads, and maxthread.

ok tedu@ mikeb@

Revision 1.218 / (download) - annotate - [select for diffs], Wed Mar 28 16:01:30 2012 UTC (12 years, 2 months ago) by guenther
Branch: MAIN
Changes since 1.217: +2 -2 lines
Diff to previous 1.217 (colored)

The kinfo_file2 structure's f_wbytes member was being filled with the
read byte count instead of the written byte count.

pointed out by paulm at tetrardus.net, ok dcoppa@

Revision 1.217 / (download) - annotate - [select for diffs], Fri Mar 23 15:51:26 2012 UTC (12 years, 2 months ago) by guenther
Branch: MAIN
Changes since 1.216: +3 -3 lines
Diff to previous 1.216 (colored)

Make rusage totals, itimers, and profile settings per-process instead
of per-rthread.  Handling of per-thread tick and runtime counters
inspired by how FreeBSD does it.

ok kettenis@

Revision 1.216 / (download) - annotate - [select for diffs], Tue Mar 13 17:28:32 2012 UTC (12 years, 3 months ago) by tedu
Branch: MAIN
Changes since 1.215: +2 -2 lines
Diff to previous 1.215 (colored)

0 is a valid uid for files sysctl, don't skip it.  ok guenther

Revision 1.215 / (download) - annotate - [select for diffs], Sat Mar 10 05:54:28 2012 UTC (12 years, 3 months ago) by guenther
Branch: MAIN
Changes since 1.214: +5 -3 lines
Diff to previous 1.214 (colored)

Add PS_EXITING to better differentiate between the process exiting and
the main thread exiting.  c.f. regress/sys/kern/main-thread-exited/

Revision 1.214 / (download) - annotate - [select for diffs], Mon Feb 20 22:23:39 2012 UTC (12 years, 3 months ago) by guenther
Branch: MAIN
Changes since 1.213: +2 -2 lines
Diff to previous 1.213 (colored)

First steps for making ptrace work with rthreads:
 - move the P_TRACED and P_INEXEC flags, and p_oppid, p_ptmask, and
   p_ptstat member from struct proc to struct process
 - sort the PT_* requests into those that take a PID vs those that
   can also take a TID
 - stub in PT_GET_THREAD_FIRST and PT_GET_THREAD_NEXT

ok kettenis@

Revision 1.213 / (download) - annotate - [select for diffs], Wed Feb 15 04:29:09 2012 UTC (12 years, 3 months ago) by guenther
Branch: MAIN
Changes since 1.212: +2 -2 lines
Diff to previous 1.212 (colored)

Enable rthreads by default

ok deraadt@

Revision 1.212 / (download) - annotate - [select for diffs], Sat Jan 21 16:30:31 2012 UTC (12 years, 4 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.211: +3 -1 lines
Diff to previous 1.211 (colored)

Make the KERN_FILE2 sysctl() report ENOMEM as documented in sysctl(3).

ok millert@

Revision 1.211 / (download) - annotate - [select for diffs], Sat Jan 7 05:38:12 2012 UTC (12 years, 5 months ago) by guenther
Branch: MAIN
Changes since 1.210: +11 -2 lines
Diff to previous 1.210 (colored)

Add rtable id and thread id to struct kinfo_proc (and fix process id)
and add an 'rtableid' keyword to ps.

Add rtable id, thread id, and socket splice info to struct kinfo_file2
and make fstat display socket splice information.

Remove old KVM_PROC2 and kinfo_proc2 interfaces; bump libkvm major

Socket splice info and corrections from bluhm@  "Lovely" deraadt@

Revision 1.210 / (download) - annotate - [select for diffs], Wed Dec 14 07:32:16 2011 UTC (12 years, 6 months ago) by guenther
Branch: MAIN
Changes since 1.209: +5 -5 lines
Diff to previous 1.209 (colored)

Handle rthreads consistently in ktrace by moving the flags and vnode into
struct process; KTRFAC_ACTIVE becomes P_INKTR.  Also, save the credentials
used to open the file in sys_ktrace() and use them for all writes to the
vnode.

much feedback and ok jsing@

Revision 1.209 / (download) - annotate - [select for diffs], Fri Dec 9 16:14:54 2011 UTC (12 years, 6 months ago) by nicm
Branch: MAIN
Changes since 1.208: +67 -1 lines
Diff to previous 1.208 (colored)

Add new KERN_PROC_CWD sysctl to get the current working directory of a process.

ok guenther deraadt

Revision 1.208 / (download) - annotate - [select for diffs], Sun Sep 18 13:23:38 2011 UTC (12 years, 8 months ago) by miod
Branch: MAIN
Changes since 1.207: +3 -3 lines
Diff to previous 1.207 (colored)

Do not use the `hh' modifier in printf format strings, as the kernel printf
implementation does not support it and handles it as `h'.
ok jsing@

Revision 1.207 / (download) - annotate - [select for diffs], Sun Sep 18 01:54:41 2011 UTC (12 years, 8 months ago) by guenther
Branch: MAIN
Changes since 1.206: +6 -8 lines
Diff to previous 1.206 (colored)

Make sysctl__string() handle the truncated output case via two
copyout()s instead of altering the in-use variable, and to also
return the full length via oldlenp in that case as documented.

ok jsing@ (problem pointed out by matthew@)

Revision 1.206 / (download) - annotate - [select for diffs], Tue Jul 5 04:48:02 2011 UTC (12 years, 11 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.205: +3 -2 lines
Diff to previous 1.205 (colored)

Recommit the reverted sigacts change now that the NFS use-after-free
problem has been tracked down.  This fixes the sharing of the signal
handling state: shared bits go in sigacts, per-rthread bits goes in
struct proc.

ok deraadt@

Revision 1.205 / (download) - annotate - [select for diffs], Mon Jun 27 03:40:35 2011 UTC (12 years, 11 months ago) by guenther
Branch: MAIN
Changes since 1.204: +5 -3 lines
Diff to previous 1.204 (colored)

Make KERN_FILE and KERN_FILE2 behavior consistent: when the caller doesn't
have the necessary rights, return f_offset=-1 and f_seek=0.

ok tedu@, matthew@

Revision 1.204 / (download) - annotate - [select for diffs], Fri Jun 24 19:47:49 2011 UTC (12 years, 11 months ago) by naddy
Branch: MAIN
Changes since 1.203: +8 -1 lines
Diff to previous 1.203 (colored)

machdep.kbdreset enables a shutdown by Ctrl-Alt-Del on amd64 and
i386.  Stop abusing it on other archs for controling a shutdown by
pressing the soft power button:

* Add a MI sysctl hw.allowpowerdown; if set to 1 (the default) it
  allows a power button shutdown.
* Make acpi(4)/acpibtn(4) honor hw.allowpowerdown.
* Switch the various power button intercepts on landisk, sgi, sparc64
  and zaurus over to hw.allowpowerdown.
* Garbage collect the machdep.kbdreset sysctl on all archs other than
  amd64 and i386.

ok miod@

Revision 1.203 / (download) - annotate - [select for diffs], Thu Jun 9 21:10:55 2011 UTC (13 years ago) by sthen
Branch: MAIN
Changes since 1.202: +2 -2 lines
Diff to previous 1.202 (colored)

Don't copy the first octet of the source IPv6 address where the destination
address should be, fixes broken fstat output for v6 socket connections.

Problem noticed by dhill@, ok todd@, "i have no idea what that diff is
touching, but it sure looks ok" halex@

Revision 1.202 / (download) - annotate - [select for diffs], Mon Apr 18 21:44:56 2011 UTC (13 years, 1 month ago) by guenther
Branch: MAIN
Changes since 1.201: +1 -2 lines
Diff to previous 1.201 (colored)

Revert the sigacts diff: NFS can apparently retain pointers to processes
until they're zombies and then send them signals (for intr mounts).  Until
that is untangled, the sigacts change is unsafe.  sthen@ was the victim
for this one

Revision 1.201 / (download) - annotate - [select for diffs], Fri Apr 15 04:52:40 2011 UTC (13 years, 2 months ago) by guenther
Branch: MAIN
Changes since 1.200: +3 -2 lines
Diff to previous 1.200 (colored)

Correct the sharing of the signal handling state: stuff that should
be shared (p_sigignore, p_sigcatch, P_NOCLDSTOP, P_NOCLDWAIT) moves
to struct sigacts, wihle stuff that should be per rthread (ps_oldmask,
SAS_OLDMASK, ps_sigstk) moves to struct proc.  Treat the coredumping
state bits (ps_sig, ps_code, ps_type, ps_sigval) as per-rthread
until our locking around coredumping is better.

Oh, and remove the old SunOS-compat ps_usertramp member.

"I like the sound of this" tedu@

Revision 1.200 / (download) - annotate - [select for diffs], Mon Apr 4 11:13:55 2011 UTC (13 years, 2 months ago) by deraadt
Branch: MAIN
Changes since 1.199: +11 -1 lines
Diff to previous 1.199 (colored)

sysctl kern.pool_debug=0 will disable POOL_DEBUG on the fly (still defaults
to on, if POOL_DEBUG is compiled in, so that boot-time pool corruption
can be found.  When the sysctl is turned off, performance is almost as
as good as compiling with POOL_DEBUG compiled out.  Not all pool page
headers can be purged of the magic checks.
performance tests by henning
ok ariane kettenis mikeb

Revision 1.199 / (download) - annotate - [select for diffs], Sat Apr 2 16:47:17 2011 UTC (13 years, 2 months ago) by beck
Branch: MAIN
Changes since 1.198: +4 -2 lines
Diff to previous 1.198 (colored)

Constrain the buffer cache to use only the dma reachable region of memory.
With this change bufcachepercent will be the percentage of dma reachable
memory that the buffer cache will attempt to use.
ok deraadt@ thib@ oga@

Revision 1.198 / (download) - annotate - [select for diffs], Sat Mar 12 04:54:28 2011 UTC (13 years, 3 months ago) by guenther
Branch: MAIN
Changes since 1.197: +34 -125 lines
Diff to previous 1.197 (colored)

Replace the old, broken KERN_PROC ABI and its matching functions
in libkvm with the stable-ABI versions that are currently named
KERN_PROC2, kvm_get{proc,argv,envv}2().  The latter names and symbols
will continue to be supported for a few releases.

Committing now that they ports people have had a couple releases
to update pkgs that usd the old functions

Revision 1.197 / (download) - annotate - [select for diffs], Wed Feb 16 10:37:45 2011 UTC (13 years, 3 months ago) by mikeb
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.196: +1 -7 lines
Diff to previous 1.196 (colored)

allow users to enable access to the /dev/crypto, but keep it turned off
by default, adjust comments in sysctl.conf;  ok markus, tedu, djm, miod

Revision 1.196 / (download) - annotate - [select for diffs], Tue Dec 14 20:26:44 2010 UTC (13 years, 5 months ago) by mikeb
Branch: MAIN
Changes since 1.195: +7 -1 lines
Diff to previous 1.195 (colored)

disable access to the crypto(4) device from userland; ok deraadt

Revision 1.195 / (download) - annotate - [select for diffs], Fri Nov 19 18:35:16 2010 UTC (13 years, 6 months ago) by mikeb
Branch: MAIN
Changes since 1.194: +4 -1 lines
Diff to previous 1.194 (colored)

Make KERN_CPTIME return an avarage number of ticks across all CPUs
tedu agreed with an idea, tested by Luis Useche and me; ok deraadt

Revision 1.194 / (download) - annotate - [select for diffs], Tue Nov 2 09:36:09 2010 UTC (13 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.193: +4 -1 lines
Diff to previous 1.193 (colored)

export the network livelock counter. part of a diff i committed the
userland side of.

pointed out by claudio@ after i embarassed myself saying "yes, its there!"

Revision 1.193 / (download) - annotate - [select for diffs], Thu Sep 23 13:24:22 2010 UTC (13 years, 8 months ago) by jsing
Branch: MAIN
Changes since 1.192: +20 -4 lines
Diff to previous 1.192 (colored)

Include the disklabel UID in hw.disknames.

ok deraadt@ krw@

Revision 1.192 / (download) - annotate - [select for diffs], Thu Aug 19 18:14:14 2010 UTC (13 years, 9 months ago) by kettenis
Branch: MAIN
Changes since 1.191: +10 -1 lines
Diff to previous 1.191 (colored)

Introduce an MI kern.consdev sysctl that will replace the MD
machdep.console_device that's only implemented on a few architectures.

ok deraadt@, miod@

Revision 1.191 / (download) - annotate - [select for diffs], Mon Jul 26 01:56:27 2010 UTC (13 years, 10 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.190: +26 -22 lines
Diff to previous 1.190 (colored)

Correct the links between threads, processes, pgrps, and sessions,
so that the process-level stuff is to/from struct process and not
struct proc.  This fixes a bunch of problem cases in rthreads.
Based on earlier work by blambert and myself, but mostly written
at c2k10.

Tested by many: deraadt, sthen, krw, ray, and in snapshots

Revision 1.190 / (download) - annotate - [select for diffs], Mon Jul 19 23:00:15 2010 UTC (13 years, 10 months ago) by guenther
Branch: MAIN
Changes since 1.189: +5 -26 lines
Diff to previous 1.189 (colored)

Rollback the allproclk and fileheadlk addition.  When grabbing an
rwlock, the thread will release biglock if it sleeps, means that
atomicity from before the rw_enter() to after it is not guaranteed.
The change didn't address those, so pulling it until it does.

"go for it" tedu@

Revision 1.189 / (download) - annotate - [select for diffs], Sat Jul 10 21:29:37 2010 UTC (13 years, 11 months ago) by guenther
Branch: MAIN
Changes since 1.188: +6 -1 lines
Diff to previous 1.188 (colored)

A process on the zombie list can have a NULL p_pgrp if it sleeps when
grabbing allproclk in proc_zap(); skip such processes in sysctl(KERN_PROC*)
and handle the NULL pointer in ddb's ps.

ok tedu@

Revision 1.188 / (download) - annotate - [select for diffs], Fri Jul 2 18:14:40 2010 UTC (13 years, 11 months ago) by guenther
Branch: MAIN
Changes since 1.187: +1 -5 lines
Diff to previous 1.187 (colored)

Since fill_eproc() is no longer called from coredump(), it can be dropped
from small kernels
"yes" deraadt@

Revision 1.187 / (download) - annotate - [select for diffs], Wed Jun 30 19:57:05 2010 UTC (13 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.186: +2 -1 lines
Diff to previous 1.186 (colored)

Add getsockopt SOL_SOCKET SO_PEERCRED support. This behaves similar to
getpeereid(2), but also supplies the remote pid.  This is supplied in
a 'struct sockpeercred' (unlike Linux -- they showed how little they
know about real unix by calling theirs 'struct ucred').
ok guenther ajacoutot

Revision 1.186 / (download) - annotate - [select for diffs], Tue Jun 29 16:39:22 2010 UTC (13 years, 11 months ago) by guenther
Branch: MAIN
Changes since 1.185: +4 -3 lines
Diff to previous 1.185 (colored)

Fail instead of lying if a process asks sysctl()'s KERN_PROC2 or
KERN_FILE2 (or their libkvm wrappers) for more information than the
running implementation knows how to provide.

ok millert@ deraadt@

Revision 1.185 / (download) - annotate - [select for diffs], Tue Jun 29 00:28:14 2010 UTC (13 years, 11 months ago) by tedu
Branch: MAIN
Changes since 1.184: +6 -1 lines
Diff to previous 1.184 (colored)

Eliminate RTHREADS kernel option in favor of a sysctl.  The actual status
(not done) hasn't changed, but now it's less work to test things.
ok art deraadt

Revision 1.184 / (download) - annotate - [select for diffs], Sat Jun 19 14:44:44 2010 UTC (13 years, 11 months ago) by thib
Branch: MAIN
Changes since 1.183: +6 -6 lines
Diff to previous 1.183 (colored)

Skip exiting procesess in sysctl_file2(). As processes in exit1()
do a pdfree() way before they remove themself from the allproc
list. This prevents a null deref found by todd@.

Joint work with mikeb

OK millert@, tedu@

Revision 1.183 / (download) - annotate - [select for diffs], Sun May 2 11:15:29 2010 UTC (14 years, 1 month ago) by kettenis
Branch: MAIN
Changes since 1.182: +2 -2 lines
Diff to previous 1.182 (colored)

Use intermediate vaddr_t cast when casting a pointer to off_t.  Prevents
gcc4 from complaining about casting a pointer to an integer type of different
size.

ok guenther@, jsg@

Revision 1.182 / (download) - annotate - [select for diffs], Tue Apr 20 20:49:33 2010 UTC (14 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.181: +7 -7 lines
Diff to previous 1.181 (colored)

Get rid of MAXSENSORDEVICES.  Gaps in sensordev lists are now handled
by returning ENXIO instead of ENOENT, to essentially indicate hotplug
sensor that has gone away.  Accessing beyond the end of the sensordev
list still returns ENOENT, so that you can see there are no further devices.
ok kettenis oga

Revision 1.181 / (download) - annotate - [select for diffs], Wed Mar 24 23:18:17 2010 UTC (14 years, 2 months ago) by tedu
Branch: MAIN
Changes since 1.180: +26 -5 lines
Diff to previous 1.180 (colored)

Add a rwlock around the filehead and allproc lists, mainly to protect
list walkers in sysctl that can block.  As a reward, no more vslock.
With some feedback from art, guenther, phessler.  ok guenther.

Revision 1.180 / (download) - annotate - [select for diffs], Sun Jan 10 03:37:50 2010 UTC (14 years, 5 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.179: +9 -129 lines
Diff to previous 1.179 (colored)

Reimplement kvm_getproc2()'s support for reading crash dumps and
/dev/mem to be direct instead of going through kvm_getprocs(), as
that function is going to get more an more broken as we move stuff
from struct proc to struct process for rthreads.  To minimize the
code copying, put the common logic of filling in a kinfo_proc2
structure into a macro FILL_KPROC2() in <sys/sysctl.h> for use from
both the kernel and user-space.  This also hides the KERN_PROC
#define behind "#if defined(_KERNEL)||defined(_LIBKVM)", as it's
deprecated.

Positive feedback from millert and blambert; so committing to unblock
further rthreads work.

Revision 1.175.4.1 / (download) - annotate - [select for diffs], Tue Dec 1 23:37:51 2009 UTC (14 years, 6 months ago) by william
Branch: OPENBSD_4_6
Changes since 1.175: +3 -1 lines
Diff to previous 1.175 (colored) next main 1.176 (colored)

MFC rev 1.177 by millert:

Handle the case where so_pcb is NULL.

ok sthen@ millert@ kettenis@

Revision 1.179 / (download) - annotate - [select for diffs], Sun Aug 9 10:40:17 2009 UTC (14 years, 10 months ago) by blambert
Branch: MAIN
Changes since 1.178: +2 -19 lines
Diff to previous 1.178 (colored)

Rototill system V message queues.

No longer allocate a static amount of memory for messages in MD
boot path; message queues, message metadata, and message data now
all use dynamic memory, which means that runtime sysctls should now
be trivial to implement.

Since I'm going to be around all week to fix any breakage, this should
probably just go in now.

Revision 1.178 / (download) - annotate - [select for diffs], Sun Aug 2 16:28:39 2009 UTC (14 years, 10 months ago) by beck
Branch: MAIN
Changes since 1.177: +13 -4 lines
Diff to previous 1.177 (colored)


Dynamic buffer cache support - a re-commit of what was backed out
after c2k9

allows buffer cache to be extended and grow/shrink dynamically

tested by many, ok oga@, "why not just commit it" deraadt@

Revision 1.177 / (download) - annotate - [select for diffs], Tue Jul 21 14:10:14 2009 UTC (14 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.176: +3 -1 lines
Diff to previous 1.176 (colored)

Handle the case where so_pcb is NULL.

Revision 1.176 / (download) - annotate - [select for diffs], Sun Jul 19 12:56:19 2009 UTC (14 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.175: +3 -1 lines
Diff to previous 1.175 (colored)

Hook up "text" (executable) output and implement for fuser too.
Man page bits adapted from FreeBSD.  OK miod@

Revision 1.175 / (download) - annotate - [select for diffs], Mon Jun 15 17:59:45 2009 UTC (14 years, 11 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE
Branch point for: OPENBSD_4_6
Changes since 1.174: +10 -1 lines
Diff to previous 1.174 (colored)

No you cannot remove a sysctl mib once you add it.  It becomes ABI.  That
is how sysctl finds them, so it can *never* be renumbered again, and must
stay

Revision 1.174 / (download) - annotate - [select for diffs], Mon Jun 15 17:01:26 2009 UTC (14 years, 11 months ago) by beck
Branch: MAIN
Changes since 1.173: +1 -19 lines
Diff to previous 1.173 (colored)

Back out all the buffer cache changes I committed during c2k9. This reverts three
commits:

1) The sysctl allowing bufcachepercent to be changed at boot time.
2) The change moving the buffer cache hash chains to a red-black tree
3) The dynamic buffer cache (Which depended on the earlier too).

ok on the backout from marco and todd

Revision 1.173 / (download) - annotate - [select for diffs], Mon Jun 8 00:52:23 2009 UTC (15 years ago) by deraadt
Branch: MAIN
Changes since 1.172: +5 -3 lines
Diff to previous 1.172 (colored)

some vnodes have a NULL mountpoint, so strlcpy of the f_mntonname if not advised

Revision 1.172 / (download) - annotate - [select for diffs], Sun Jun 7 03:07:19 2009 UTC (15 years ago) by millert
Branch: MAIN
Changes since 1.171: +296 -3 lines
Diff to previous 1.171 (colored)

Add KERN_FILE2 sysctl analogous to KERN_PROC2 but for file structures,
along with vnode type-specific info to make it more useful for fstat(1).
OK deraadt@

Revision 1.171 / (download) - annotate - [select for diffs], Fri Jun 5 04:29:14 2009 UTC (15 years ago) by beck
Branch: MAIN
Changes since 1.170: +3 -2 lines
Diff to previous 1.170 (colored)

Dynamic buffer cache sizing.

This commit won't change the default behaviour of the system unless the
buffer cache size is increased with sysctl kern.bufcachepercent. By default
our buffer cache is 10% of memory, which with this commit is now treated
as a low water mark.  If the buffer cache size is increased, the new size
is treated as a high water mark and the buffer cache is permitted to grow
to that percentage of memory.

If the page daemon is invoked, the page daemon will ask the buffer cache
to relenquish pages. if the buffer cache has more than the low water mark it
will relenquish pages allowing them to be consumed by uvm. after a short
period the buffer cache will attempt to re-grow back to the high water mark.

This permits the use of a large buffer cache without penalizing the available
memory for other purposes.

Above the low water mark the buffer cache remains entirely subservient to
the page daemon, so if uvm requires pages, the buffer cache will abandon
them.

ok art@ thib@ oga@

Revision 1.170 / (download) - annotate - [select for diffs], Wed Jun 3 21:30:20 2009 UTC (15 years ago) by beck
Branch: MAIN
Changes since 1.169: +18 -1 lines
Diff to previous 1.169 (colored)

add kern.bufcachepercent sysctl to allow adjusting the buffer cache
size on a running system.
ok art@, oga@

Revision 1.169 / (download) - annotate - [select for diffs], Sun Apr 19 17:53:38 2009 UTC (15 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.168: +3 -1 lines
Diff to previous 1.168 (colored)

Count number of cpus found (potentially not attached) and store that
in sysctl hw.ncpufound; ok miod kettenis

Revision 1.168 / (download) - annotate - [select for diffs], Wed Jan 21 21:02:40 2009 UTC (15 years, 4 months ago) by miod
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.167: +2 -2 lines
Diff to previous 1.167 (colored)

Pass the new pointer to sysctl_clockrate(), so that trying to change the
value of kern.clockrate with sysctl(3) correctly sets errno on failure.
PR #6040, ok tedu@

Revision 1.167 / (download) - annotate - [select for diffs], Fri Oct 31 17:18:24 2008 UTC (15 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.166: +12 -11 lines
Diff to previous 1.166 (colored)

Do not assume that a pointer to another process will live over a set of
sleeping calls.  Since we are simply operating on another process'
vmspace, grab a (refcounted) copy of that pointer and use that instead.
originally spotted by kurt, discussed with art

Revision 1.166 / (download) - annotate - [select for diffs], Fri Oct 31 17:17:08 2008 UTC (15 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.165: +0 -0 lines
Diff to previous 1.165 (colored)

accidental commit ... backout

Revision 1.165 / (download) - annotate - [select for diffs], Fri Oct 31 17:17:05 2008 UTC (15 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.164: +10 -11 lines
Diff to previous 1.164 (colored)

accidental commit ... backout

Revision 1.164 / (download) - annotate - [select for diffs], Fri Oct 31 17:15:30 2008 UTC (15 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.163: +12 -11 lines
Diff to previous 1.163 (colored)

kern_sysctl.c

Revision 1.163 / (download) - annotate - [select for diffs], Thu Oct 9 07:48:55 2008 UTC (15 years, 8 months ago) by kevlo
Branch: MAIN
Changes since 1.162: +2 -2 lines
Diff to previous 1.162 (colored)

pass NULL rather than 0 for interrupt time usage to calcru()

ok art@

Revision 1.162 / (download) - annotate - [select for diffs], Tue Oct 7 02:20:11 2008 UTC (15 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.161: +16 -5 lines
Diff to previous 1.161 (colored)

Do not display file offsets and a few other pieces of information, except
to the user or the superuser.  Display * for those fields instead.  From
PR 5113, but modified to use copyout correctly.
comments from tedu, ok from others

Revision 1.161 / (download) - annotate - [select for diffs], Mon Jun 9 07:07:16 2008 UTC (16 years ago) by djm
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.160: +2 -2 lines
Diff to previous 1.160 (colored)

rename arc4random_bytes => arc4random_buf to match libc's nicer name;
ok deraadt@

Revision 1.160 / (download) - annotate - [select for diffs], Sat Feb 9 15:10:58 2008 UTC (16 years, 4 months ago) by kettenis
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.159: +7 -1 lines
Diff to previous 1.159 (colored)

Introduce HW_PHYSMEM64 and HW_USERMEM64 sysctls, which don't overflow on
machines with more than 4GB of memory.  Make sysctl(8) print values obtained
using these sysctls for hw.physmem and hw.usermem.

ok krw@, miod@

Revision 1.159 / (download) - annotate - [select for diffs], Sun Dec 23 01:59:58 2007 UTC (16 years, 5 months ago) by dlg
Branch: MAIN
Changes since 1.158: +5 -1 lines
Diff to previous 1.158 (colored)

protect the disk statistics with a mutex.

ok tedu@ kettenis@

Revision 1.158 / (download) - annotate - [select for diffs], Wed Oct 10 15:53:53 2007 UTC (16 years, 8 months ago) by art
Branch: MAIN
Changes since 1.157: +2 -4 lines
Diff to previous 1.157 (colored)

Make context switching much more MI:
 - Move the functionality of choosing a process from cpu_switch into
   a much simpler function: cpu_switchto. Instead of having the locore
   code walk the run queues, let the MI code choose the process we
   want to run and only implement the context switching itself in MD
   code.
 - Let MD context switching run without worrying about spls or locks.
 - Instead of having the idle loop implemented with special contexts
   in MD code, implement one idle proc for each cpu. make the idle
   loop MI with MD hooks.
 - Change the proc lists from the old style vax queues to TAILQs.
 - Change the sleep queue from vax queues to TAILQs. This makes
   wakeup() go from O(n^2) to O(n)

there will be some MD fallout, but it will be fixed shortly.
There's also a few cleanups to be done after this.

deraadt@, kettenis@ ok

Revision 1.157 / (download) - annotate - [select for diffs], Fri Sep 7 15:00:20 2007 UTC (16 years, 9 months ago) by art
Branch: MAIN
Changes since 1.156: +4 -7 lines
Diff to previous 1.156 (colored)

Use M_ZERO in a few more places to shave bytes from the kernel.

eyeballed and ok dlg@

Revision 1.156 / (download) - annotate - [select for diffs], Sat Sep 1 15:14:44 2007 UTC (16 years, 9 months ago) by martin
Branch: MAIN
Changes since 1.155: +3 -3 lines
Diff to previous 1.155 (colored)

replace the machine dependant bytes-to-clicks macro by the MI ptoa()
version for i386

more architectures and ctob() replacement is being worked on

prodded by and ok miod

Revision 1.155 / (download) - annotate - [select for diffs], Thu Aug 9 04:12:12 2007 UTC (16 years, 10 months ago) by cnst
Branch: MAIN
CVS Tags: OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.154: +2 -2 lines
Diff to previous 1.154 (colored)

be more consistent in memcpy usage; no md5 change in .o; ok deraadt@

Revision 1.154 / (download) - annotate - [select for diffs], Fri Jun 1 17:29:10 2007 UTC (17 years ago) by beck
Branch: MAIN
Changes since 1.153: +2 -2 lines
Diff to previous 1.153 (colored)

decouple the allocated number of vnodes from the "desiredvnodes" variable
which is used to size a zillion other things that increasing excessively
has been shown to cause problems - so that we may incrementally look at
increasing those other things without making the kernel unusable.

This diff effectivly increases the number of vnodes back to the number
of buffers, as in the earlier dynamic buffer cache commits, without
increasing anything else (namecache, softdeps, etc. etc.)

ok pedro@ tedu@ art@ thib@

Revision 1.153 / (download) - annotate - [select for diffs], Tue May 29 00:17:32 2007 UTC (17 years ago) by thib
Branch: MAIN
Changes since 1.152: +3 -3 lines
Diff to previous 1.152 (colored)

Add a name argument to the RWLOCK_INITIALIZER macro.
Pick reasonble names for the locks involved..

ok tedu@, art@

Revision 1.152 / (download) - annotate - [select for diffs], Wed May 16 17:27:30 2007 UTC (17 years, 1 month ago) by art
Branch: MAIN
Changes since 1.151: +3 -12 lines
Diff to previous 1.151 (colored)

The world of __HAVEs and __HAVE_NOTs is reducing. All architectures
have cpu_info now, so kill the option.

eyeballed by jsg@ and grange@

Revision 1.151 / (download) - annotate - [select for diffs], Wed Apr 18 16:57:06 2007 UTC (17 years, 1 month ago) by art
Branch: MAIN
Changes since 1.150: +5 -1 lines
Diff to previous 1.150 (colored)

When vslocking memory for the sysctl make sure that we aren't trying
to wire more memory than we are allowed to.

miod@ ok

Revision 1.150 / (download) - annotate - [select for diffs], Thu Apr 12 22:14:15 2007 UTC (17 years, 2 months ago) by tedu
Branch: MAIN
Changes since 1.149: +3 -2 lines
Diff to previous 1.149 (colored)

move p_limit and p_cred into struct process
leave macros behind for now to keep the commit small
ok art beck miod pedro

Revision 1.149 / (download) - annotate - [select for diffs], Thu Mar 22 16:55:31 2007 UTC (17 years, 2 months ago) by deraadt
Branch: MAIN
Changes since 1.148: +28 -18 lines
Diff to previous 1.148 (colored)

split userland & kernel struct sensor/sensordev so that the addition
of new fields in the future is less disruptive.  This is done similar
to how struct proc is handled for ps(1).  ok jmc (man page changes)
tested fkr simon, and more suggestions from millert

Revision 1.148 / (download) - annotate - [select for diffs], Tue Feb 20 17:42:29 2007 UTC (17 years, 3 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.147: +24 -8 lines
Diff to previous 1.147 (colored)

for sensors do not leak kernel pointers when copying out to userland;
spotted by art, ok dlg art

Revision 1.147 / (download) - annotate - [select for diffs], Fri Jan 12 07:41:31 2007 UTC (17 years, 5 months ago) by art
Branch: MAIN
Changes since 1.146: +8 -22 lines
Diff to previous 1.146 (colored)

Switch some lockmgr locks to rwlocks.
In this commit:
 - gdt lock on amd64
 - sysctl lock
 - malloc sysctl lock
 - disk sysctl lock
 - swap syscall lock

miod@, pedro@ ok (and "looks good" others@)

Revision 1.146 / (download) - annotate - [select for diffs], Sat Dec 23 17:41:26 2006 UTC (17 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.145: +19 -5 lines
Diff to previous 1.145 (colored)

kernel code implimemting the new two-level sensor api; written by
Constantine A. Murenin

Revision 1.145 / (download) - annotate - [select for diffs], Tue Dec 12 23:14:28 2006 UTC (17 years, 6 months ago) by dim
Branch: MAIN
Changes since 1.144: +2 -2 lines
Diff to previous 1.144 (colored)

Complete gwk's previous patch to stop setperf methods from returning
errors to userland: make all cpu_setperf functions return void.

Tested by many, ok gwk@

Revision 1.144 / (download) - annotate - [select for diffs], Fri Dec 8 23:08:19 2006 UTC (17 years, 6 months ago) by gwk
Branch: MAIN
Changes since 1.143: +7 -9 lines
Diff to previous 1.143 (colored)

A more permanent solution to setperf methods returning error values and
the higher level sysctl code passing them to userland. Distinct diff from
the one I passed around internally with less crazy semantics. Also nuke
some trailing spaces in a few places.
"just go ahead" deraadt@

Revision 1.143 / (download) - annotate - [select for diffs], Wed Nov 29 12:24:17 2006 UTC (17 years, 6 months ago) by miod
Branch: MAIN
Changes since 1.142: +3 -7 lines
Diff to previous 1.142 (colored)

Kernel stack can be swapped. This means that stuff that's on the stack
should never be referenced outside the context of the process to which
this stack belongs unless we do the PHOLD/PRELE dance. Loads of code
doesn't follow the rules here. Instead of trying to track down all
offenders and fix this hairy situation, it makes much more sense
to not swap kernel stacks.

From art@, tested by many some time ago.

Revision 1.142 / (download) - annotate - [select for diffs], Sun May 28 19:41:42 2006 UTC (18 years ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.141: +6 -9 lines
Diff to previous 1.141 (colored)

back out my last commit. art pointed out that sysctl cannot sleep when
copying out to userland, so my fix was useless bloat that didnt really do
anything. the problem instead appears to be a use after free in a driver
rather than bad interactions with sysctl.

Revision 1.141 / (download) - annotate - [select for diffs], Sat May 20 22:55:46 2006 UTC (18 years ago) by dlg
Branch: MAIN
Changes since 1.140: +10 -7 lines
Diff to previous 1.140 (colored)

It is possible for a sensor to be detached and freed while it is being
copied out to userland. If this happens we get a use after free and things
blow up. Prevent this by making a local copy of the sensor that cannot be
freed elsewhere in the kernel and copying that out instead.

found by mbalmer@
ok deraadt@ krw@

Revision 1.140 / (download) - annotate - [select for diffs], Mon May 8 22:51:18 2006 UTC (18 years, 1 month ago) by gwk
Branch: MAIN
Changes since 1.139: +30 -1 lines
Diff to previous 1.139 (colored)

Add smbios support for i386 and amd64, fix ipmi to use this new functionallity,
hook up some sysctls to add system vendor/product/version and UUID reporting.

"get it in" deraadt@

Revision 1.139 / (download) - annotate - [select for diffs], Wed Mar 15 21:02:09 2006 UTC (18 years, 3 months ago) by deraadt
Branch: MAIN
Changes since 1.138: +21 -1 lines
Diff to previous 1.138 (colored)

add sysctl_int_lower().  This can read, but can only write to a kernel
variable if the result is a lowering of the value; tested matthieu

Revision 1.138 / (download) - annotate - [select for diffs], Sat Jan 28 09:53:37 2006 UTC (18 years, 4 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.137: +7 -7 lines
Diff to previous 1.137 (colored)

get rid of the sensors globals. theyre were only used by sysctl for
locating and finding the correct sensor to spit out. instead provide a
a sensor_get function that wraps up the access to the vars. theyre now
safe inside kern_sensors.c.

theres also a touch of whitespace tweaking

ok grange@

Revision 1.137 / (download) - annotate - [select for diffs], Thu Jan 19 17:08:40 2006 UTC (18 years, 4 months ago) by grange
Branch: MAIN
Changes since 1.136: +4 -6 lines
Diff to previous 1.136 (colored)

Replace SENSOR_ADD() macro with a pair of functions
sensor_add()/sensor_del() so that sensors can be attached
and detached dynamicaly.

ok kettenis@ deraadt@ dlg@

Revision 1.136 / (download) - annotate - [select for diffs], Mon Nov 28 00:14:29 2005 UTC (18 years, 6 months ago) by jsg
Branch: MAIN
Changes since 1.135: +32 -117 lines
Diff to previous 1.135 (colored)

ansi/deregister.
'go for it' deraadt@

Revision 1.135 / (download) - annotate - [select for diffs], Mon Nov 21 13:47:52 2005 UTC (18 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.134: +3 -3 lines
Diff to previous 1.134 (colored)

rename the sensor globals to names that are not obvious to avoid
collisions with local variable names someone might make. this has bitten
me twice now and caused me to lose about 4 hours scratching my head when
nsensors just magically corrupts and gets bigger. at least my ram isnt
screwed.

ok marco@

Revision 1.134 / (download) - annotate - [select for diffs], Sat Nov 19 02:18:01 2005 UTC (18 years, 6 months ago) by pedro
Branch: MAIN
Changes since 1.133: +6 -6 lines
Diff to previous 1.133 (colored)

Remove unnecessary lockmgr() archaism that was costing too much in terms
of panics and bugfixes. Access curproc directly, do not expect a process
pointer as an argument. Should fix many "process context required" bugs.
Incentive and okay millert@, okay marc@. Various testing, thanks.

Revision 1.133 / (download) - annotate - [select for diffs], Thu Nov 10 08:10:16 2005 UTC (18 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.132: +1 -3 lines
Diff to previous 1.132 (colored)

split the sensors stuff out into a source file of its own.

tested on GENERIC and RAMDISK_CD to see if the small_kernel stuff stays
happy

Revision 1.132 / (download) - annotate - [select for diffs], Fri Nov 4 21:47:57 2005 UTC (18 years, 7 months ago) by miod
Branch: MAIN
Changes since 1.131: +4 -4 lines
Diff to previous 1.131 (colored)

Add an extra flags argument to uvm_io(), to specify whether we want to fix
the protection of the memory mapping we're doing I/O on, or if we want to
leave them as they are. This should only be necessary for breakpoint
insertion in code, so we'll only use it for ptrace requests.

Initially from art@ after discussion with kettenis@ millert@ and I,
tested by many.

Revision 1.131 / (download) - annotate - [select for diffs], Sun Sep 25 20:48:23 2005 UTC (18 years, 8 months ago) by miod
Branch: MAIN
Changes since 1.130: +3 -3 lines
Diff to previous 1.130 (colored)

Turn CPU_INFO_FOREACH into a real construct, like all queue(3) iterators,
instead of the contents of a for() loop. No functional change.
From the m88k SMP tree; ok art@ deraadt@

[complete diff this time]

Revision 1.130 / (download) - annotate - [select for diffs], Tue Sep 20 23:01:06 2005 UTC (18 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.129: +2 -2 lines
Diff to previous 1.129 (colored)

unbreak tree, how did you do that miod

Revision 1.129 / (download) - annotate - [select for diffs], Tue Sep 20 21:04:15 2005 UTC (18 years, 8 months ago) by miod
Branch: MAIN
Changes since 1.128: +3 -3 lines
Diff to previous 1.128 (colored)

Turn CPU_INFO_FOREACH into a real construct, like all queue(3) iterators,
instead of the contents of a for() loop. No functional change.
From the m88k SMP tree; ok art@ deraadt@

Revision 1.128 / (download) - annotate - [select for diffs], Sun Jul 31 04:36:51 2005 UTC (18 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.127: +26 -16 lines
Diff to previous 1.127 (colored)

do not allocate huge kinfo_proc2 and eproc structures on the stack.
allocate them on startup if needed, and free them when done.
discussion with pascoe, tested by dlg

Revision 1.127 / (download) - annotate - [select for diffs], Wed Jun 8 22:33:27 2005 UTC (19 years ago) by millert
Branch: MAIN
Changes since 1.126: +35 -1 lines
Diff to previous 1.126 (colored)

Add KERN_CPTIME2 on systems where __HAVE_CPUINFO is defined, exposes
spc_cp_time member of struct schedstate_percpu (per-cpu stats).
From art@ during the hackathon.

Revision 1.126 / (download) - annotate - [select for diffs], Sat Jun 4 05:10:40 2005 UTC (19 years ago) by tedu
Branch: MAIN
Changes since 1.125: +13 -3 lines
Diff to previous 1.125 (colored)

let the arc4random sysctl write out up to 256 bytes at once.
ok + input deraadt miod

Revision 1.125 / (download) - annotate - [select for diffs], Tue May 24 21:11:48 2005 UTC (19 years ago) by tedu
Branch: MAIN
Changes since 1.124: +3 -3 lines
Diff to previous 1.124 (colored)

add a new field to vm_space and use it to track the number of anon
pages a process uses.  this is now the userland "data size" value.
ok art deraadt tdeval.  thanks testers.

Revision 1.124 / (download) - annotate - [select for diffs], Thu Mar 10 17:26:10 2005 UTC (19 years, 3 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.123: +4 -1 lines
Diff to previous 1.123 (colored)

split out uidinfo from kern_proc.c private, use it to store lock count,
restrict lock count per uid to a global limit, add sysctl to adjust limit.
this prevents a user from creating too many locks.  problem noticed
by devon o'dell.  ok deraadt miod pedro

Revision 1.123 / (download) - annotate - [select for diffs], Fri Dec 24 17:28:13 2004 UTC (19 years, 5 months ago) by miod
Branch: MAIN
Changes since 1.122: +21 -3 lines
Diff to previous 1.122 (colored)

Do not provide the KERN_EMUL, KERN_EVCOUNT, KERN_INTRCNT, KERN_PROC* and
HW_SENSORS sysctl trees if option SMALL_KERNEL.
ok deraadt@

Revision 1.122 / (download) - annotate - [select for diffs], Fri Nov 26 21:23:06 2004 UTC (19 years, 6 months ago) by miod
Branch: MAIN
Changes since 1.121: +1 -43 lines
Diff to previous 1.121 (colored)

Kill __HAVE_EVCOUNT, now that all architectures provide them.

Revision 1.121 / (download) - annotate - [select for diffs], Thu Oct 14 17:10:17 2004 UTC (19 years, 8 months ago) by mickey
Branch: MAIN
Changes since 1.120: +2 -2 lines
Diff to previous 1.120 (colored)

a more reasonable limit for the stackgap_random; found by openbsd@hunger.hu

Revision 1.120 / (download) - annotate - [select for diffs], Thu Sep 23 21:08:54 2004 UTC (19 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.119: +2 -2 lines
Diff to previous 1.119 (colored)

change KERN_INTRCNT_CNT to return a quad; ok tedu

Revision 1.119 / (download) - annotate - [select for diffs], Wed Sep 15 17:50:33 2004 UTC (19 years, 8 months ago) by grange
Branch: MAIN
Changes since 1.118: +2 -2 lines
Diff to previous 1.118 (colored)

Check for num < 0 in sysctl_sensors(); from Patrick Latifi.

ok millert@

Revision 1.118 / (download) - annotate - [select for diffs], Wed Jul 28 17:15:12 2004 UTC (19 years, 10 months ago) by tholo
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.117: +12 -1 lines
Diff to previous 1.117 (colored)

This touches only MI code, and adds new time keeping code.  The
code is all conditionalized on __HAVE_TIMECOUNTER, and not
enabled on any platforms.

adjtime(2) support exists, courtesy of nordin@, sysctl(2) support
and a concept of quality for each time source attached exists.

High quality time sources exists for PIIX4 ACPI timer as well as
some AMD power management chips.  This will have to be redone
once we actually add ACPI support (at that time we need to use
the ACPI interfaces to get at these clocks).

ok art@ ken@ miod@ jmc@ and many more

Revision 1.117 / (download) - annotate - [select for diffs], Mon Jun 28 01:34:46 2004 UTC (19 years, 11 months ago) by aaron
Branch: MAIN
Changes since 1.116: +16 -1 lines
Diff to previous 1.116 (colored)

Add new, generic ``evcount'' event counter API to the kernel.  From art@,
with modifications from me.  Includes code for generic interrupt counter
fetching via sysctl.  deraadt@ tholo@ drahn@ millert@ ok

Revision 1.116 / (download) - annotate - [select for diffs], Fri Jun 25 08:41:19 2004 UTC (19 years, 11 months ago) by art
Branch: MAIN
Changes since 1.115: +2 -2 lines
Diff to previous 1.115 (colored)

Instead of accessing ci_dev (that's an MI field), provide a marco that
translates a cpu_info structure into a human-readable cpu number.

drahn@ deraadt@ ok

Revision 1.115 / (download) - annotate - [select for diffs], Thu Jun 24 21:00:03 2004 UTC (19 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.114: +9 -7 lines
Diff to previous 1.114 (colored)

Remove the 8 page limit for sysctl_proc_args after discussing with Theo.
Add trivial support for passing a NULL pointer for the argv buffer;
currently just returns ARG_MAX for KERN_PROC_ARGV and KERN_PROC_ENV.

Revision 1.114 / (download) - annotate - [select for diffs], Sun Jun 20 03:04:15 2004 UTC (19 years, 11 months ago) by art
Branch: MAIN
Changes since 1.113: +2 -2 lines
Diff to previous 1.113 (colored)

Another merge error from smp branch.
Found by otto@drijf.net
deraadt@ ok

Revision 1.113 / (download) - annotate - [select for diffs], Wed Jun 16 18:14:12 2004 UTC (19 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.112: +2 -2 lines
Diff to previous 1.112 (colored)

export cpu# instead of apid#; art ok

Revision 1.112 / (download) - annotate - [select for diffs], Sun Jun 13 21:49:26 2004 UTC (20 years ago) by niklas
Branch: MAIN
Changes since 1.111: +20 -1 lines
Diff to previous 1.111 (colored)

debranch SMP, have fun

Revision 1.29.4.20 / (download) - annotate - [select for diffs], Fri Jun 11 05:29:25 2004 UTC (20 years ago) by drahn
Branch: SMP
Changes since 1.29.4.19: +15 -1 lines
Diff to previous 1.29.4.19 (colored) to branchpoint 1.29 (colored) next main 1.30 (colored)

For MULTIPROCESSOR, sum the individual cpu's cp_time into the global cpu_time.

Revision 1.29.4.19 / (download) - annotate - [select for diffs], Thu Jun 10 11:40:33 2004 UTC (20 years ago) by niklas
Branch: SMP
Changes since 1.29.4.18: +5 -1 lines
Diff to previous 1.29.4.18 (colored) to branchpoint 1.29 (colored)

sync with head, make i386 __HAVE_CPUINFO

Revision 1.111 / (download) - annotate - [select for diffs], Wed Jun 9 20:18:28 2004 UTC (20 years ago) by art
Branch: MAIN
CVS Tags: SMP_SYNC_B, SMP_SYNC_A
Changes since 1.110: +5 -1 lines
Diff to previous 1.110 (colored)

Merge in a piece of the SMP branch into HEAD.

Introduce the cpu_info structure, p_cpu field in struct proc and global
scheduling context and various changed code to deal with this. At the
moment no architecture uses this stuff yet, but it will allow us slow and
controlled migration to the new APIs.

All new code is ifdef:ed out.

ok deraadt@ niklas@

Revision 1.29.4.18 / (download) - annotate - [select for diffs], Tue Jun 8 20:07:03 2004 UTC (20 years ago) by deraadt
Branch: SMP
Changes since 1.29.4.17: +2 -5 lines
Diff to previous 1.29.4.17 (colored) to branchpoint 1.29 (colored)

minimize diffs against kinfo_proc2 setup; markus ok

Revision 1.110 / (download) - annotate - [select for diffs], Tue Jun 8 18:09:31 2004 UTC (20 years ago) by marc
Branch: MAIN
Changes since 1.109: +2 -2 lines
Diff to previous 1.109 (colored)

pull ncpus support from smp tree into main branch.
remove alpha specific definition of ncpus.
OK (and tested on alpha) deraadt@

Revision 1.29.4.17 / (download) - annotate - [select for diffs], Sat Jun 5 23:13:01 2004 UTC (20 years ago) by niklas
Branch: SMP
Changes since 1.29.4.16: +64 -12 lines
Diff to previous 1.29.4.16 (colored) to branchpoint 1.29 (colored)

Merge with the trunk

Revision 1.29.4.16 / (download) - annotate - [select for diffs], Sat Jun 5 17:19:55 2004 UTC (20 years ago) by niklas
Branch: SMP
Changes since 1.29.4.15: +3 -1 lines
Diff to previous 1.29.4.15 (colored) to branchpoint 1.29 (colored)

Make a few scheduling globals per-cpu, mostly NetBSD code

Revision 1.109 / (download) - annotate - [select for diffs], Thu May 27 08:19:59 2004 UTC (20 years ago) by tedu
Branch: MAIN
Changes since 1.108: +6 -7 lines
Diff to previous 1.108 (colored)

apm restores perflevel after resume; some cpus are forgetful.
update cpu even with 100 -> 100 setperf changes, in case saved value
has gotten out of sync.  from grange@ ok deraadt@ grange@

Revision 1.108 / (download) - annotate - [select for diffs], Sun May 23 19:41:23 2004 UTC (20 years ago) by tedu
Branch: MAIN
Changes since 1.107: +5 -4 lines
Diff to previous 1.107 (colored)

bad stuff escaped by accident

Revision 1.107 / (download) - annotate - [select for diffs], Sun May 23 19:37:24 2004 UTC (20 years ago) by tedu
Branch: MAIN
Changes since 1.106: +5 -6 lines
Diff to previous 1.106 (colored)

according to fork1(9), retval is optional.  make it so.
from form@pdp-11.org.ru via mpech.  ok millert

Revision 1.106 / (download) - annotate - [select for diffs], Mon Apr 19 22:52:33 2004 UTC (20 years, 1 month ago) by tedu
Branch: MAIN
Changes since 1.105: +8 -1 lines
Diff to previous 1.105 (colored)

introduce a new km_page allocator that gets pages from kernel_map using
an interrupt safe thread.
use this as the new backend for mbpool and mclpool, eliminating the mb_map.
introduce a sysctl kern.maxclusters which controls the limit of clusters
allocated.
testing by many people, works everywhere but m68k.  ok deraadt@

this essentially deprecates the NMBCLUSTERS option, don't use it.
this should reduce pressure on the kmem_map and the uvm reserve of static
map entries.

Revision 1.105 / (download) - annotate - [select for diffs], Thu Apr 15 00:22:42 2004 UTC (20 years, 2 months ago) by tedu
Branch: MAIN
Changes since 1.104: +6 -4 lines
Diff to previous 1.104 (colored)

rework access to emulations slightly in an effort to both merge and
separate exec format from emulation.  consistent naming of freebsd emuls.
not much in the way of functional changes yet.
testing and ok deraadt@ and others along the way.

Revision 1.29.4.15 / (download) - annotate - [select for diffs], Sun Mar 14 22:08:21 2004 UTC (20 years, 3 months ago) by niklas
Branch: SMP
Changes since 1.29.4.14: +7 -1 lines
Diff to previous 1.29.4.14 (colored) to branchpoint 1.29 (colored)

Some merged code from NetBSD, more to come

Revision 1.104 / (download) - annotate - [select for diffs], Sun Feb 29 12:14:05 2004 UTC (20 years, 3 months ago) by weingart
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.103: +3 -1 lines
Diff to previous 1.103 (colored)

Check for negative numbers.

ok grange@

Revision 1.103 / (download) - annotate - [select for diffs], Fri Feb 27 21:46:44 2004 UTC (20 years, 3 months ago) by grange
Branch: MAIN
Changes since 1.102: +1 -2 lines
Diff to previous 1.102 (colored)

Move setperf_prio to the machdep code, requested by deraadt@

ok deraadt@

Revision 1.102 / (download) - annotate - [select for diffs], Fri Feb 27 21:15:45 2004 UTC (20 years, 3 months ago) by grange
Branch: MAIN
Changes since 1.101: +2 -1 lines
Diff to previous 1.101 (colored)

Introduce simple priorities mechanism so that concurrent
hw.setperf handlers don't override each other.
Problem reported and tested by danh@.

ok tedu@ deraadt@

Revision 1.29.4.14 / (download) - annotate - [select for diffs], Thu Feb 19 10:56:37 2004 UTC (20 years, 3 months ago) by niklas
Branch: SMP
Changes since 1.29.4.13: +312 -49 lines
Diff to previous 1.29.4.13 (colored) to branchpoint 1.29 (colored)

Merge of current from two weeks agointo the SMP branch

Revision 1.101 / (download) - annotate - [select for diffs], Sun Feb 15 11:14:45 2004 UTC (20 years, 4 months ago) by markus
Branch: MAIN
Changes since 1.100: +21 -1 lines
Diff to previous 1.100 (colored)

add sysctl_int_arr() API similar to BSD/OS; ok itojun, deraadt, miod, henning

Revision 1.100 / (download) - annotate - [select for diffs], Sun Feb 15 02:45:46 2004 UTC (20 years, 4 months ago) by tedu
Branch: MAIN
Changes since 1.99: +13 -5 lines
Diff to previous 1.99 (colored)

new arg to disk_unbusy, to record separate read/write statistics.
looked at by various, testing henning@ mcbride@ dan weeks
mostly from netbsd via Pedro Martelletto <pbastos@rdc.puc-rio.br>

Revision 1.99 / (download) - annotate - [select for diffs], Sat Feb 14 15:09:22 2004 UTC (20 years, 4 months ago) by grange
Branch: MAIN
Changes since 1.98: +19 -5 lines
Diff to previous 1.98 (colored)

Simplify hw.{cpuspeed,setperf} api moving all the sysctl stuff
from the underlying callbacks.

Testing hppa mickey@, ppc drahn@
Ok markus@ tedu@

Revision 1.98 / (download) - annotate - [select for diffs], Wed Jan 7 21:51:30 2004 UTC (20 years, 5 months ago) by millert
Branch: MAIN
Changes since 1.97: +3 -1 lines
Diff to previous 1.97 (colored)

Add p_rlim_rss_cur for ps "lim" field.  OK deraadt@

Revision 1.97 / (download) - annotate - [select for diffs], Wed Jan 7 21:30:59 2004 UTC (20 years, 5 months ago) by markus
Branch: MAIN
Changes since 1.96: +3 -1 lines
Diff to previous 1.96 (colored)

no kern_watchdog for SMALL_KERNEL; ok deraadt@

Revision 1.96 / (download) - annotate - [select for diffs], Wed Jan 7 19:34:03 2004 UTC (20 years, 5 months ago) by millert
Branch: MAIN
Changes since 1.95: +4 -1 lines
Diff to previous 1.95 (colored)

Unbreak KERN_PROC_KTHREAD.  Explicitly list KERN_PROC_KTHREAD in
the sysctl_doproc() switch so it does not match the default case
(EINVAL).  deraadt@ OK.

Revision 1.95 / (download) - annotate - [select for diffs], Wed Jan 7 03:37:57 2004 UTC (20 years, 5 months ago) by millert
Branch: MAIN
Changes since 1.94: +2 -1 lines
Diff to previous 1.94 (colored)

Add p_emul to kinfo_proc2 for ps

Revision 1.94 / (download) - annotate - [select for diffs], Wed Jan 7 02:13:51 2004 UTC (20 years, 5 months ago) by millert
Branch: MAIN
Changes since 1.93: +239 -33 lines
Diff to previous 1.93 (colored)

Implement KERN_PROC2 sysctl from NetBSD.  This will allow us to
have ps and friends be independent of changes in struct proc et al
in the kernel.  OK deraadt@

Revision 1.93 / (download) - annotate - [select for diffs], Thu Dec 18 23:46:20 2003 UTC (20 years, 5 months ago) by tedu
Branch: MAIN
Changes since 1.92: +12 -1 lines
Diff to previous 1.92 (colored)

add new hw sysctls, cpuspeed and setperf to control cpu frequency.
convert longrun support to use new sysctls.
add enhanced speedstep support, based on code by Michael Eriksson.
idea, help testing & ok deraadt@

Revision 1.92 / (download) - annotate - [select for diffs], Sun Nov 23 20:17:14 2003 UTC (20 years, 6 months ago) by millert
Branch: MAIN
Changes since 1.91: +2 -2 lines
Diff to previous 1.91 (colored)

Check correct array index KERN_VNODE; from Alistair Kerr
Closes PR 3571 as per on icb.

Revision 1.91 / (download) - annotate - [select for diffs], Sun Oct 26 22:31:23 2003 UTC (20 years, 7 months ago) by tedu
Branch: MAIN
Changes since 1.90: +2 -2 lines
Diff to previous 1.90 (colored)

per deraadt@ request, don't permit insanely large stackgap values.

Revision 1.90 / (download) - annotate - [select for diffs], Fri Oct 24 19:05:21 2003 UTC (20 years, 7 months ago) by tedu
Branch: MAIN
Changes since 1.89: +10 -11 lines
Diff to previous 1.89 (colored)

refactor stackgap sysctl.  prompted by a bug report from Michael Coulter.
ok deraadt@ markus@

Revision 1.89 / (download) - annotate - [select for diffs], Sat Aug 23 20:02:59 2003 UTC (20 years, 9 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.88: +6 -10 lines
Diff to previous 1.88 (colored)

remove native emulations from emulsw.  you can't change them and probably
aren't interested, so keep them out of the sysctl.  ok deraadt

Revision 1.88 / (download) - annotate - [select for diffs], Sat Aug 23 19:21:15 2003 UTC (20 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.87: +3 -3 lines
Diff to previous 1.87 (colored)

knf

Revision 1.87 / (download) - annotate - [select for diffs], Sat Aug 23 18:12:20 2003 UTC (20 years, 9 months ago) by fgsch
Branch: MAIN
Changes since 1.86: +1 -1 lines
Diff to previous 1.86 (colored)

allow disabling a emul after enabling it; tedu@ ok.

Revision 1.86 / (download) - annotate - [select for diffs], Thu Aug 21 18:56:07 2003 UTC (20 years, 9 months ago) by tedu
Branch: MAIN
Changes since 1.85: +43 -1 lines
Diff to previous 1.85 (colored)

emulation is now controlled by sysctl.  changes:
add e_flags to struct emul.  this stores on/off and native flags.
check for emul enabled in check_exec().  gather all the emuls into a
emulsw so a sysctl can find them.  create sysctl.  move maxhdrsiz calcualation
into init_main so it cleans up sys_execve codepath.  teach sysctl utility
to grok kern.emul hierarchy.
requested and ok deraadt@  some comments from mickey@

Revision 1.85 / (download) - annotate - [select for diffs], Fri Aug 15 20:32:18 2003 UTC (20 years, 10 months ago) by tedu
Branch: MAIN
Changes since 1.84: +2 -2 lines
Diff to previous 1.84 (colored)

change arguments to suser.  suser now takes the process, and a flags
argument.  old cred only calls user suser_ucred.  this will allow future
work to more flexibly implement the idea of a root process.  looks like
something i saw in freebsd, but a little different.
use of suser_ucred vs suser in file system code should be looked at again,
for the moment semantics remain unchanged.
review and input from art@  testing and further review miod@

Revision 1.84 / (download) - annotate - [select for diffs], Wed Aug 6 21:08:07 2003 UTC (20 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.83: +2 -2 lines
Diff to previous 1.83 (colored)

Remove some double semicolons (hmm, do two semis equal a maxi?).
I've skipped the GNU stuff for now.  From Patrick Latifi.

Revision 1.83 / (download) - annotate - [select for diffs], Tue Jun 10 21:50:26 2003 UTC (21 years ago) by mickey
Branch: MAIN
Changes since 1.82: +3 -2 lines
Diff to previous 1.82 (colored)

debug0 and debug1 are defined elsewhere -- make 'em extern here

Revision 1.29.4.13 / (download) - annotate - [select for diffs], Sat Jun 7 11:03:40 2003 UTC (21 years ago) by ho
Branch: SMP
Changes since 1.29.4.12: +2 -6 lines
Diff to previous 1.29.4.12 (colored) to branchpoint 1.29 (colored)

Sync SMP branch to -current

Revision 1.82 / (download) - annotate - [select for diffs], Mon Jun 2 23:28:06 2003 UTC (21 years ago) by millert
Branch: MAIN
Changes since 1.81: +2 -6 lines
Diff to previous 1.81 (colored)

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999.  Proofed by myself and Theo.

Revision 1.60.2.3 / (download) - annotate - [select for diffs], Mon May 19 22:31:10 2003 UTC (21 years ago) by tedu
Branch: UBC
Changes since 1.60.2.2: +118 -13 lines
Diff to previous 1.60.2.2 (colored) to branchpoint 1.60 (colored) next main 1.61 (colored)

sync

Revision 1.29.4.12 / (download) - annotate - [select for diffs], Tue May 13 19:21:28 2003 UTC (21 years, 1 month ago) by ho
Branch: SMP
Changes since 1.29.4.11: +34 -4 lines
Diff to previous 1.29.4.11 (colored) to branchpoint 1.29 (colored)

Sync the SMP branch to -current. This includes moving to ELF.

Revision 1.81 / (download) - annotate - [select for diffs], Sat May 3 21:14:59 2003 UTC (21 years, 1 month ago) by deraadt
Branch: MAIN
CVS Tags: UBC_SYNC_A
Changes since 1.80: +3 -2 lines
Diff to previous 1.80 (colored)

string fixes; tedu ok

Revision 1.80 / (download) - annotate - [select for diffs], Fri Apr 25 20:06:41 2003 UTC (21 years, 1 month ago) by grange
Branch: MAIN
Changes since 1.79: +32 -3 lines
Diff to previous 1.79 (colored)

sysctl front-end for the hardware monitoring sensors. This adds
new node hw.sensors; information from the sensors can be obtained
via hw.sensors.n, where n is a sensor number. All values are read only
for now. Documentation and back-end drivers are comming.
Tested by henning@ and millert@. Four oks from henning@ and one
from millert@.

Revision 1.29.4.11 / (download) - annotate - [select for diffs], Fri Mar 28 00:41:26 2003 UTC (21 years, 2 months ago) by niklas
Branch: SMP
Changes since 1.29.4.10: +318 -17 lines
Diff to previous 1.29.4.10 (colored) to branchpoint 1.29 (colored)

Sync the SMP branch with 3.3

Revision 1.79 / (download) - annotate - [select for diffs], Tue Jan 21 16:59:23 2003 UTC (21 years, 4 months ago) by markus
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3
Changes since 1.78: +5 -1 lines
Diff to previous 1.78 (colored)

add kern.watchdog sysctl and generic watchdog interface;
based on feedback and discussions with mickey, henric, fgsch and jakob.
ok art@, mickey@, jakob@, henric@

Revision 1.78 / (download) - annotate - [select for diffs], Wed Jan 15 23:41:56 2003 UTC (21 years, 5 months ago) by millert
Branch: MAIN
Changes since 1.77: +3 -3 lines
Diff to previous 1.77 (colored)

Fix two minor nits; deraadt@ OK
o Avoid taking the address of an array when we just want a pointer
o Use &array[1] not array + 1

Revision 1.77 / (download) - annotate - [select for diffs], Mon Jan 13 06:04:16 2003 UTC (21 years, 5 months ago) by art
Branch: MAIN
Changes since 1.76: +43 -1 lines
Diff to previous 1.76 (colored)

Sysctls for fetching intrcnt.

Revision 1.76 / (download) - annotate - [select for diffs], Tue Dec 17 23:11:31 2002 UTC (21 years, 5 months ago) by millert
Branch: MAIN
Changes since 1.75: +37 -8 lines
Diff to previous 1.75 (colored)

Make SysV-style shared memory and semaphore limits sysctl'able.
Instead of allocating a static amount of memory for the data
structures via valloc() in allocsys(), allocate things dynamically
using pool(9) when possible and malloc(9) when not.  The various
members of struct seminfo and struct shminfo are in kern.seminfo
and kern.shminfo respectively (not all members of kern.seminfo are
changable).

The data structures used still leave something to be desired but
things are not made worse in that respect by this commit.

Revision 1.60.2.2 / (download) - annotate - [select for diffs], Tue Oct 29 00:36:44 2002 UTC (21 years, 7 months ago) by art
Branch: UBC
Changes since 1.60.2.1: +54 -17 lines
Diff to previous 1.60.2.1 (colored) to branchpoint 1.60 (colored)

sync to -current

Revision 1.75 / (download) - annotate - [select for diffs], Sun Sep 1 11:35:52 2002 UTC (21 years, 9 months ago) by art
Branch: MAIN
CVS Tags: UBC_SYNC_B, OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.74: +1 -2 lines
Diff to previous 1.74 (colored)

Oppsie. Remove my debugging code.
noted by tdeval@

Revision 1.74 / (download) - annotate - [select for diffs], Fri Aug 23 15:33:12 2002 UTC (21 years, 9 months ago) by art
Branch: MAIN
Changes since 1.73: +2 -2 lines
Diff to previous 1.73 (colored)

Use LIST_ macros for the list of all struct file.

Revision 1.73 / (download) - annotate - [select for diffs], Sat Jul 6 19:14:20 2002 UTC (21 years, 11 months ago) by nordin
Branch: MAIN
Changes since 1.72: +1 -3 lines
Diff to previous 1.72 (colored)

Remove kernel support for NTP. ok deraadt@ and tholo@

Revision 1.72 / (download) - annotate - [select for diffs], Mon Jun 24 11:09:01 2002 UTC (21 years, 11 months ago) by art
Branch: MAIN
Changes since 1.71: +49 -13 lines
Diff to previous 1.71 (colored)

Redo the logic of reading of proc arguments to be more readable.
kjell@ says that it fixes his problems, noone else responded.

Revision 1.71 / (download) - annotate - [select for diffs], Tue Jun 11 11:14:29 2002 UTC (22 years ago) by beck
Branch: MAIN
Changes since 1.70: +5 -1 lines
Diff to previous 1.70 (colored)

kernel changes to make asymmetric crypto work in userland
- modify getfeat to return something more useful to us on devices
  (like lofn and everything else until jason fixes it) that can't
  do rsa stuff, etc and can only do mod_exp..
- error handling fixes so we correctly fail to software when we can't
  deal with a particular key size
- add sysctl kern.userasymcrypto to turn on/off userland asymmetric crypto
  via /dev/crypto - 1 == on, 0 == off, default is off

Revision 1.60.2.1 / (download) - annotate - [select for diffs], Tue Jun 11 03:29:40 2002 UTC (22 years ago) by art
Branch: UBC
Changes since 1.60: +211 -11 lines
Diff to previous 1.60 (colored)

Sync UBC branch to -current

Revision 1.70 / (download) - annotate - [select for diffs], Sun Jun 9 05:46:15 2002 UTC (22 years ago) by art
Branch: MAIN
Changes since 1.69: +10 -6 lines
Diff to previous 1.69 (colored)

add struct pstats to struct eproc

Revision 1.69 / (download) - annotate - [select for diffs], Sun Jun 9 04:27:25 2002 UTC (22 years ago) by angelos
Branch: MAIN
Changes since 1.68: +5 -1 lines
Diff to previous 1.68 (colored)

KERN_MBSTAT

Revision 1.68 / (download) - annotate - [select for diffs], Sat Jun 8 23:35:35 2002 UTC (22 years ago) by angelos
Branch: MAIN
Changes since 1.67: +6 -1 lines
Diff to previous 1.67 (colored)

TTYCOUNT and NUMVNODES.

Revision 1.67 / (download) - annotate - [select for diffs], Sat Jun 8 23:17:22 2002 UTC (22 years ago) by angelos
Branch: MAIN
Changes since 1.66: +3 -1 lines
Diff to previous 1.66 (colored)

Add read-only KERN_NFILES (number of open files).

Revision 1.66 / (download) - annotate - [select for diffs], Sat Jun 8 22:24:47 2002 UTC (22 years ago) by art
Branch: MAIN
Changes since 1.65: +174 -3 lines
Diff to previous 1.65 (colored)

Sysctl for getting process arguments and environment.

Revision 1.65 / (download) - annotate - [select for diffs], Wed May 15 23:17:53 2002 UTC (22 years, 1 month ago) by art
Branch: MAIN
Changes since 1.64: +4 -1 lines
Diff to previous 1.64 (colored)

Implement splassert() for sparc - a tool for finding problems related to
spl handling (already found 3 problems).

Man page in a few seconds.
deraadt@ ok.

Revision 1.29.4.10 / (download) - annotate - [select for diffs], Thu Mar 28 11:43:04 2002 UTC (22 years, 2 months ago) by niklas
Branch: SMP
Changes since 1.29.4.9: +3 -3 lines
Diff to previous 1.29.4.9 (colored) to branchpoint 1.29 (colored)

Merge in -current from about a week ago

Revision 1.64 / (download) - annotate - [select for diffs], Thu Mar 14 20:31:31 2002 UTC (22 years, 3 months ago) by mickey
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.63: +1 -2 lines
Diff to previous 1.63 (colored)

remove ambiguity in version,ostype,osversion,osrelease and their constanity, they are and declarre 'em accordingly also removing private externies of those

Revision 1.63 / (download) - annotate - [select for diffs], Thu Mar 14 19:42:54 2002 UTC (22 years, 3 months ago) by mickey
Branch: MAIN
Changes since 1.62: +5 -4 lines
Diff to previous 1.62 (colored)

version[] is externed in the systm.h and give it some const

Revision 1.29.4.9 / (download) - annotate - [select for diffs], Wed Mar 6 02:13:23 2002 UTC (22 years, 3 months ago) by niklas
Branch: SMP
Changes since 1.29.4.8: +11 -0 lines
Diff to previous 1.29.4.8 (colored) to branchpoint 1.29 (colored)

Merge in trunk

Revision 1.62 / (download) - annotate - [select for diffs], Fri Mar 1 02:52:51 2002 UTC (22 years, 3 months ago) by provos
Branch: MAIN
Changes since 1.61: +5 -1 lines
Diff to previous 1.61 (colored)

sysctl for cryptodevallowsoft - /dev/crypto will allow the software engine
to be used if there are no hardware cards.  mostly for debugging and
regression.

Revision 1.61 / (download) - annotate - [select for diffs], Sat Feb 23 08:11:05 2002 UTC (22 years, 3 months ago) by deraadt
Branch: MAIN
Changes since 1.60: +8 -1 lines
Diff to previous 1.60 (colored)

sysctl kern.usercrypto

Revision 1.29.4.8 / (download) - annotate - [select for diffs], Wed Dec 5 01:02:39 2001 UTC (22 years, 6 months ago) by niklas
Branch: SMP
Changes since 1.29.4.7: +6 -4 lines
Diff to previous 1.29.4.7 (colored) to branchpoint 1.29 (colored)

Merge in -current

Revision 1.60 / (download) - annotate - [select for diffs], Wed Nov 28 13:47:39 2001 UTC (22 years, 6 months ago) by art
Branch: MAIN
CVS Tags: UBC_BASE
Branch point for: UBC
Changes since 1.59: +7 -5 lines
Diff to previous 1.59 (colored)

Sync in more uvm changes from NetBSD.
This time we're getting rid of KERN_* and VM_PAGER_* error codes and
use errnos instead.

Revision 1.29.4.7 / (download) - annotate - [select for diffs], Tue Nov 13 23:04:23 2001 UTC (22 years, 7 months ago) by niklas
Branch: SMP
Changes since 1.29.4.6: +2 -4 lines
Diff to previous 1.29.4.6 (colored) to branchpoint 1.29 (colored)

merge in -current

Revision 1.59 / (download) - annotate - [select for diffs], Tue Nov 6 19:53:20 2001 UTC (22 years, 7 months ago) by miod
Branch: MAIN
Changes since 1.58: +2 -4 lines
Diff to previous 1.58 (colored)

Replace inclusion of <vm/foo.h> with the correct <uvm/bar.h> when necessary.
(Look ma, I might have broken the tree)

Revision 1.29.4.6 / (download) - annotate - [select for diffs], Wed Oct 31 03:26:29 2001 UTC (22 years, 7 months ago) by nate
Branch: SMP
Changes since 1.29.4.5: +171 -5 lines
Diff to previous 1.29.4.5 (colored) to branchpoint 1.29 (colored)

Sync the SMP branch to something just after 3.0

Revision 1.58 / (download) - annotate - [select for diffs], Fri Sep 28 01:42:54 2001 UTC (22 years, 8 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0
Changes since 1.57: +147 -2 lines
Diff to previous 1.57 (colored)

sysctl() support for getting the SYSV *info structs and the associated
SYSV structs.  To be used by ipcs(1).  Based on work by simonb@netbsd.org

Revision 1.57 / (download) - annotate - [select for diffs], Fri Sep 7 22:03:21 2001 UTC (22 years, 9 months ago) by angelos
Branch: MAIN
Changes since 1.56: +6 -2 lines
Diff to previous 1.56 (colored)

Fix PR 2051, tested by miod@

Revision 1.56 / (download) - annotate - [select for diffs], Sat Aug 18 03:32:16 2001 UTC (22 years, 9 months ago) by art
Branch: MAIN
Changes since 1.55: +17 -2 lines
Diff to previous 1.55 (colored)

Add a possibility to add a random offset to the stack on exec. This makes
it slightly harder to write generic buffer overflows. This doesn't really
give any real security, but it raises the bar for script-kiddies and it's
really cheap.

The range of the random offsets is controlled by the sysctl
kern.stackgap_random (must be a power of 2).

This is disabled by default right now, but we'll set it to a reasonable value
(1024?) soon, after some more testing.

Revision 1.55 / (download) - annotate - [select for diffs], Tue Jul 17 20:57:49 2001 UTC (22 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.54: +3 -1 lines
Diff to previous 1.54 (colored)

It takes a greek to put buffer overflow and unterminated string
handling into the kernel.  Stick with the complicated stuff dude,
breaking this simple shit is killing us!

Revision 1.54 / (download) - annotate - [select for diffs], Fri Jul 13 23:46:12 2001 UTC (22 years, 11 months ago) by mickey
Branch: MAIN
Changes since 1.53: +2 -2 lines
Diff to previous 1.53 (colored)

make kern_msgbuf work for sparc, i thought it worked for me before; from miod

Revision 1.29.4.5 / (download) - annotate - [select for diffs], Wed Jul 4 10:48:27 2001 UTC (22 years, 11 months ago) by niklas
Branch: SMP
Changes since 1.29.4.4: +141 -33 lines
Diff to previous 1.29.4.4 (colored) to branchpoint 1.29 (colored)

Merge in -current from two days ago in the SMP branch.
As usual with merges, they do not indicate progress, so do not hold
your breath for working SMP, and do not mail me and ask about the
state of it.  It has not changed.  There is work ongoing, but very, very
slowly.  The commit is done in parts as to not lock up the tree in too
big chunks at a time.

Revision 1.53 / (download) - annotate - [select for diffs], Wed Jun 27 07:21:27 2001 UTC (22 years, 11 months ago) by art
Branch: MAIN
Changes since 1.52: +1 -4 lines
Diff to previous 1.52 (colored)

uvm_useracc is not necessary now that uvm_vslock knows how to fail.

Revision 1.52 / (download) - annotate - [select for diffs], Wed Jun 27 04:49:46 2001 UTC (22 years, 11 months ago) by art
Branch: MAIN
Changes since 1.51: +1 -24 lines
Diff to previous 1.51 (colored)

remove old vm

Revision 1.51 / (download) - annotate - [select for diffs], Sun Jun 24 16:00:47 2001 UTC (22 years, 11 months ago) by art
Branch: MAIN
Changes since 1.50: +5 -2 lines
Diff to previous 1.50 (colored)

Add a sysctl for getting pool information out of the kernel.

Revision 1.50 / (download) - annotate - [select for diffs], Fri Jun 22 21:32:58 2001 UTC (22 years, 11 months ago) by mickey
Branch: MAIN
Changes since 1.49: +7 -1 lines
Diff to previous 1.49 (colored)

provide sysctl iface for msgbuf; raadtified

Revision 1.49 / (download) - annotate - [select for diffs], Sun Jun 3 18:40:23 2001 UTC (23 years ago) by deraadt
Branch: MAIN
Changes since 1.48: +3 -3 lines
Diff to previous 1.48 (colored)

e_wmesg was not initialized in all cases; kirk.russell@acm.org

Revision 1.48 / (download) - annotate - [select for diffs], Sun Jun 3 04:41:33 2001 UTC (23 years ago) by angelos
Branch: MAIN
Changes since 1.47: +3 -1 lines
Diff to previous 1.47 (colored)

Export nprocs.

Revision 1.47 / (download) - annotate - [select for diffs], Sun Jun 3 03:53:57 2001 UTC (23 years ago) by angelos
Branch: MAIN
Changes since 1.46: +7 -2 lines
Diff to previous 1.46 (colored)

KERN_FSCALE and KERN_CCPU

Revision 1.46 / (download) - annotate - [select for diffs], Sun Jun 3 03:28:41 2001 UTC (23 years ago) by angelos
Branch: MAIN
Changes since 1.45: +22 -27 lines
Diff to previous 1.45 (colored)

Pass struct diskstats through sysctl, deraadt@ ok

Revision 1.29.4.4 / (download) - annotate - [select for diffs], Mon May 14 22:32:42 2001 UTC (23 years, 1 month ago) by niklas
Branch: SMP
Changes since 1.29.4.3: +80 -24 lines
Diff to previous 1.29.4.3 (colored) to branchpoint 1.29 (colored)

merge in approximately 2.9 into SMP branch

Revision 1.45 / (download) - annotate - [select for diffs], Mon May 14 08:03:14 2001 UTC (23 years, 1 month ago) by angelos
Branch: MAIN
Changes since 1.44: +24 -17 lines
Diff to previous 1.44 (colored)

Use lockmgr locks for kern.malloc.kmemstat and
hw.diskstats/hw.disknames.

Revision 1.44 / (download) - annotate - [select for diffs], Mon May 14 07:18:05 2001 UTC (23 years, 1 month ago) by angelos
Branch: MAIN
Changes since 1.43: +100 -3 lines
Diff to previous 1.43 (colored)

Disk statistics via sysctl, first pass (locking to come in a few, then
use a separate sub-structure for the statistics)

Revision 1.43 / (download) - annotate - [select for diffs], Fri May 11 06:38:47 2001 UTC (23 years, 1 month ago) by angelos
Branch: MAIN
Changes since 1.42: +16 -2 lines
Diff to previous 1.42 (colored)

kmemstats, nselcoll, forkstat, and nchstats structures through
sysctl. deraadt@ ok

Revision 1.42 / (download) - annotate - [select for diffs], Mon May 7 22:16:35 2001 UTC (23 years, 1 month ago) by art
Branch: MAIN
Changes since 1.41: +7 -2 lines
Diff to previous 1.41 (colored)

Check for failure now that uvm_vslock can return one. Before this, there was
a risk that we could crash when doing physio/sysctl when the system was
completly out of RAM and swap.

Revision 1.41 / (download) - annotate - [select for diffs], Fri Apr 6 23:41:02 2001 UTC (23 years, 2 months ago) by art
Branch: MAIN
CVS Tags: OPENBSD_2_9_BASE, OPENBSD_2_9
Changes since 1.40: +1 -5 lines
Diff to previous 1.40 (colored)

Get rid of vm_pmap from struct vmspace.

Revision 1.40 / (download) - annotate - [select for diffs], Fri Mar 23 23:36:39 2001 UTC (23 years, 2 months ago) by millert
Branch: MAIN
Changes since 1.39: +3 -1 lines
Diff to previous 1.39 (colored)

Take vm_pmap out of struct vmspace if we are using UVM since UVM doesn't
use that.  Fixes size mismatch in i386 pmap.new kernel.
This requires that users rebuild libkvm and friends using the new headers
for ps et al to work with a new kernel.

Revision 1.39 / (download) - annotate - [select for diffs], Fri Mar 16 08:49:09 2001 UTC (23 years, 3 months ago) by art
Branch: MAIN
Changes since 1.38: +13 -18 lines
Diff to previous 1.38 (colored)

Use a lockmgr lock for keeping down the vslocked memory in sysctl
instead of a home-brew equivalent.

Revision 1.38 / (download) - annotate - [select for diffs], Wed Jan 31 09:59:51 2001 UTC (23 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.37: +7 -2 lines
Diff to previous 1.37 (colored)

add kern.cp_time sysctl, to be used by various things

Revision 1.37 / (download) - annotate - [select for diffs], Thu Jan 4 06:04:42 2001 UTC (23 years, 5 months ago) by angelos
Branch: MAIN
Changes since 1.36: +54 -2 lines
Diff to previous 1.36 (colored)

sysctl_quad/sysctl_rdquad, and "malloc" node in kern sysctl

Revision 1.36 / (download) - annotate - [select for diffs], Sun Jun 18 17:59:55 2000 UTC (23 years, 11 months ago) by niklas
Branch: MAIN
CVS Tags: OPENBSD_2_8_BASE, OPENBSD_2_8
Changes since 1.35: +8 -2 lines
Diff to previous 1.35 (colored)

Mark kernel threads as system processes.  Make ps hide them by default,
show them with -k.  Do not try to show RSS based values for them as they
mess up column alignment.  vmstat -f now shows kernel threads separately
from rforks too.

Revision 1.35 / (download) - annotate - [select for diffs], Mon Jun 5 11:02:51 2000 UTC (24 years ago) by art
Branch: MAIN
Changes since 1.34: +2 -2 lines
Diff to previous 1.34 (colored)

Changes to exit handling.

cpu_exit no longer frees the vmspace and u-area. This is now handled by a
separate kernel thread "reaper". This is to avoid sleeping locks in the
critical path of cpu_exit where we're not allowed to sleep.

From NetBSD

Revision 1.34 / (download) - annotate - [select for diffs], Sat May 6 17:08:14 2000 UTC (24 years, 1 month ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_7_BASE, OPENBSD_2_7
Changes since 1.33: +2 -2 lines
Diff to previous 1.33 (colored)

work around filleproc() vs exit1() race of p_rlimit

Revision 1.29.4.3 / (download) - annotate - [select for diffs], Fri Mar 24 09:09:25 2000 UTC (24 years, 2 months ago) by niklas
Branch: SMP
Changes since 1.29.4.2: +4 -4 lines
Diff to previous 1.29.4.2 (colored) to branchpoint 1.29 (colored)

Sync with -current

Revision 1.33 / (download) - annotate - [select for diffs], Thu Mar 16 22:11:03 2000 UTC (24 years, 3 months ago) by art
Branch: MAIN
Changes since 1.32: +2 -2 lines
Diff to previous 1.32 (colored)

Bring in some new UVM code from NetBSD (not current).

 - Introduce a new type of map that are interrupt safe and never allow faults
   in them. mb_map and kmem_map are made intrsafe.
 - Add "access protection" to uvm_vslock (to be passed down to uvm_fault and
   later to pmap_enter).
 - madvise(2) now works.
 - various cleanups.

Revision 1.32 / (download) - annotate - [select for diffs], Fri Mar 3 11:46:09 2000 UTC (24 years, 3 months ago) by art
Branch: MAIN
Changes since 1.31: +2 -2 lines
Diff to previous 1.31 (colored)

Use the LIST_FIRST macro to get the head of zombproc list.

Revision 1.31 / (download) - annotate - [select for diffs], Fri Mar 3 11:31:43 2000 UTC (24 years, 3 months ago) by art
Branch: MAIN
Changes since 1.30: +3 -3 lines
Diff to previous 1.30 (colored)

Use LIST_ macros instead of internal field names to walk the allproc list.

Revision 1.29.4.2 / (download) - annotate - [select for diffs], Thu Mar 2 07:04:40 2000 UTC (24 years, 3 months ago) by niklas
Branch: SMP
Changes since 1.29.4.1: +10 -1 lines
Diff to previous 1.29.4.1 (colored) to branchpoint 1.29 (colored)

Sync with -current

Revision 1.30 / (download) - annotate - [select for diffs], Tue Feb 22 19:28:03 2000 UTC (24 years, 3 months ago) by deraadt
Branch: MAIN
Changes since 1.29: +10 -1 lines
Diff to previous 1.29 (colored)

enlarge msgbuf, somewhat line netbsd did

Revision 1.29.4.1 / (download) - annotate - [select for diffs], Sun Feb 20 11:57:17 2000 UTC (24 years, 3 months ago) by niklas
Branch: SMP
Changes since 1.29: +2 -2 lines
Diff to previous 1.29 (colored)

Merge in recent code from the trunk

Revision 1.29 / (download) - annotate - [select for diffs], Tue Jun 29 23:51:59 1999 UTC (24 years, 11 months ago) by provos
Branch: MAIN
CVS Tags: kame_19991208, SMP_BASE, OPENBSD_2_6_BASE, OPENBSD_2_6
Branch point for: SMP
Changes since 1.28: +3 -1 lines
Diff to previous 1.28 (colored)

add sysctl kern.arandom to get a random integer. useful when chrooted with
no /dev/arandom.

Revision 1.28 / (download) - annotate - [select for diffs], Tue Jun 1 08:23:51 1999 UTC (25 years ago) by art
Branch: MAIN
Changes since 1.27: +3 -7 lines
Diff to previous 1.27 (colored)

remove the "ifdef pmap_resident_count" hack and replace it with a macro.
change some &vm->vm_pmap to vm->vm_map.pmap

Revision 1.27 / (download) - annotate - [select for diffs], Fri Feb 26 04:57:15 1999 UTC (25 years, 3 months ago) by art
Branch: MAIN
CVS Tags: OPENBSD_2_5_BASE, OPENBSD_2_5
Changes since 1.26: +26 -1 lines
Diff to previous 1.26 (colored)

compat with uvm sysctl, some uvm name changes, cnt.foo -> uvmexp.bar

Revision 1.26 / (download) - annotate - [select for diffs], Tue Jul 7 07:12:40 1998 UTC (25 years, 11 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_4_BASE, OPENBSD_2_4
Changes since 1.25: +43 -7 lines
Diff to previous 1.25 (colored)

per XPG, gethostname() with a short buffer returns truncated data - not ENOMEM.
As permitted, make the truncated buffer be NUL terminated.
make getdomainname() match.

Revision 1.25 / (download) - annotate - [select for diffs], Tue Jun 2 06:10:28 1998 UTC (26 years ago) by deraadt
Branch: MAIN
Changes since 1.24: +21 -1 lines
Diff to previous 1.24 (colored)

add sysctl and sysconf support for sysvsem, sysvshm, sysvmsg, and fsync; mostly from kleink

Revision 1.24 / (download) - annotate - [select for diffs], Mon Dec 8 21:25:37 1997 UTC (26 years, 6 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_3_BASE, OPENBSD_2_3
Changes since 1.23: +4 -2 lines
Diff to previous 1.23 (colored)

add kern.nosuidcoredump to lock things out even more

Revision 1.23 / (download) - annotate - [select for diffs], Thu Nov 6 15:59:49 1997 UTC (26 years, 7 months ago) by kstailey
Branch: MAIN
Changes since 1.22: +3 -1 lines
Diff to previous 1.22 (colored)

fix ps(1) LIM column

Revision 1.22 / (download) - annotate - [select for diffs], Thu Nov 6 05:58:19 1997 UTC (26 years, 7 months ago) by csapuntz
Branch: MAIN
Changes since 1.21: +6 -3 lines
Diff to previous 1.21 (colored)

Updates for VFS Lite 2 + soft update.

Revision 1.21 / (download) - annotate - [select for diffs], Mon Oct 6 20:19:58 1997 UTC (26 years, 8 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_2_BASE, OPENBSD_2_2
Changes since 1.20: +2 -5 lines
Diff to previous 1.20 (colored)

back out vfs lite2 till after 2.2

Revision 1.20 / (download) - annotate - [select for diffs], Mon Oct 6 15:12:25 1997 UTC (26 years, 8 months ago) by csapuntz
Branch: MAIN
Changes since 1.19: +6 -3 lines
Diff to previous 1.19 (colored)

VFS Lite2 Changes

Revision 1.19 / (download) - annotate - [select for diffs], Wed Sep 3 13:51:08 1997 UTC (26 years, 9 months ago) by kstailey
Branch: MAIN
Changes since 1.18: +3 -1 lines
Diff to previous 1.18 (colored)

changes for ps "emul" option

Revision 1.18 / (download) - annotate - [select for diffs], Sun Jun 22 04:58:03 1997 UTC (26 years, 11 months ago) by flipk
Branch: MAIN
Changes since 1.17: +5 -1 lines
Diff to previous 1.17 (colored)

wasn't a race after all. properly initialize event_q pointers so the
last one doesn't point off the end.

Revision 1.17 / (download) - annotate - [select for diffs], Sat Jun 21 04:59:44 1997 UTC (26 years, 11 months ago) by flipk
Branch: MAIN
Changes since 1.16: +0 -4 lines
Diff to previous 1.16 (colored)

revert, there's a nasty race condition here.

Revision 1.16 / (download) - annotate - [select for diffs], Sat Jun 14 21:37:10 1997 UTC (27 years ago) by mickey
Branch: MAIN
Changes since 1.15: +5 -1 lines
Diff to previous 1.15 (colored)

split the treatment of the random events
event_q by flipk@
spl fix by deraadt@
gother statistics about whole processing
use 'sysctl kern.random' to view what had happened
also fix wrong vm.psstrings description

Revision 1.15 / (download) - annotate - [select for diffs], Thu Mar 27 04:39:35 1997 UTC (27 years, 2 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_1_BASE, OPENBSD_2_1
Changes since 1.14: +2 -2 lines
Diff to previous 1.14 (colored)

Make kern.osrevision (sysctl) and /kern/osrev report value of
OpenBSD define, not BSD which is a bit more useful.

Revision 1.14 / (download) - annotate - [select for diffs], Wed Mar 26 17:23:50 1997 UTC (27 years, 2 months ago) by deraadt
Branch: MAIN
Changes since 1.13: +3 -2 lines
Diff to previous 1.13 (colored)

loginname copying in fill_eproc; gwing@primenet.com.au

Revision 1.13 / (download) - annotate - [select for diffs], Fri Oct 4 01:26:47 1996 UTC (27 years, 8 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_0_BASE, OPENBSD_2_0
Changes since 1.12: +4 -1 lines
Diff to previous 1.12 (colored)

usermount sysctl, default to prevent users from using mount syscall

Revision 1.12 / (download) - annotate - [select for diffs], Fri Sep 20 22:53:09 1996 UTC (27 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.11: +6 -1 lines
Diff to previous 1.11 (colored)

`solve' the syn bomb problem as well as currently known; add sysctl's for
SOMAXCONN (kern.somaxconn), SOMINCONN (kern.sominconn), and TCPTV_KEEP_INIT
(net.inet.tcp.keepinittime). when this is not enough (ie. overfull), start
doing tail drop, but slightly prefer the same port.

Revision 1.11 / (download) - annotate - [select for diffs], Thu Aug 8 06:36:45 1996 UTC (27 years, 10 months ago) by tholo
Branch: MAIN
Changes since 1.10: +1 -3 lines
Diff to previous 1.10 (colored)

Make {,f}chown(2) behaviour POSIX.1 compliant with SUID / SGID files
Enable CTL_FS processing by sysctl(3)
Add CTL_FS request to disable clearing SUID / SGID bit when a files owner
or group is changed by root
Make sysctl(8) understand CTL_FS requests

Revision 1.10 / (download) - annotate - [select for diffs], Sat Jun 29 21:07:52 1996 UTC (27 years, 11 months ago) by tholo
Branch: MAIN
Changes since 1.9: +2 -2 lines
Diff to previous 1.9 (colored)

Add external declaration for osversion[]

Revision 1.9 / (download) - annotate - [select for diffs], Sat Jun 29 21:04:21 1996 UTC (27 years, 11 months ago) by tholo
Branch: MAIN
Changes since 1.8: +3 -1 lines
Diff to previous 1.8 (colored)

MIssed this one in previous commit; make uname(1) and uname(3) do the
right thing for the version field

Revision 1.8 / (download) - annotate - [select for diffs], Fri May 24 22:17:44 1996 UTC (28 years ago) by dm
Branch: MAIN
Changes since 1.7: +2 -2 lines
Diff to previous 1.7 (colored)

When INSECURE is not defined, leave securelevel in the BSS so the kernel
binary is harder to patch.  (Basically undo last change).

Revision 1.7 / (download) - annotate - [select for diffs], Thu May 23 08:33:15 1996 UTC (28 years ago) by deraadt
Branch: MAIN
Changes since 1.6: +2 -2 lines
Diff to previous 1.6 (colored)

force securelevel to 0

Revision 1.6 / (download) - annotate - [select for diffs], Tue Apr 23 15:03:52 1996 UTC (28 years, 1 month ago) by dm
Branch: MAIN
Changes since 1.5: +3 -2 lines
Diff to previous 1.5 (colored)

Allow the security level to be lowered when in security level 0

Revision 1.5 / (download) - annotate - [select for diffs], Sun Apr 21 22:27:10 1996 UTC (28 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.4: +3 -4 lines
Diff to previous 1.4 (colored)

partial sync with netbsd 960418, more to come

Revision 1.4 / (download) - annotate - [select for diffs], Fri Apr 19 16:08:59 1996 UTC (28 years, 1 month ago) by niklas
Branch: MAIN
Changes since 1.3: +4 -2 lines
Diff to previous 1.3 (colored)

NetBSD 960317 merge

Revision 1.3 / (download) - annotate - [select for diffs], Sat Mar 30 04:51:32 1996 UTC (28 years, 2 months ago) by mickey
Branch: MAIN
Changes since 1.2: +10 -1 lines
Diff to previous 1.2 (colored)

Added: sysctl access to the ddb variables.
Fixed: "netbsd" strings in sym table handling routines.
now it is usefull to change max_{width,line} according
to your real console geometry, just w/ sysctl program.

Revision 1.2 / (download) - annotate - [select for diffs], Sun Mar 3 17:19:56 1996 UTC (28 years, 3 months ago) by niklas
Branch: MAIN
Changes since 1.1: +27 -21 lines
Diff to previous 1.1 (colored)

From NetBSD: 960217 merge

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Wed Oct 18 08:52:44 1995 UTC (28 years, 8 months ago) by deraadt
CVS Tags: netbsd_1_1
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored)

initial import of NetBSD tree

Revision 1.1 / (download) - annotate - [select for diffs], Wed Oct 18 08:52:44 1995 UTC (28 years, 8 months ago) by deraadt
Branch: MAIN

Initial revision

This form allows you to request diff's 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.