6 hours agoboot/common/fs.h: Add a common definition of CTASSERT(). master
Sascha Wildner [Tue, 20 Mar 2018 09:11:06 +0000 (10:11 +0100)]
boot/common/fs.h: Add a common definition of CTASSERT().

7 hours ago<net/if_poll.h>: Add license. It was based on sys/net/if_poll.c.
Sascha Wildner [Tue, 20 Mar 2018 08:12:02 +0000 (09:12 +0100)]
<net/if_poll.h>: Add license. It was based on sys/net/if_poll.c.

Reported-by: Aaron LI <aly@aaronly.me>
Discussed-with: sephe

13 hours agokernel - Attempt to fix high vnlru cpu use
Matthew Dillon [Tue, 20 Mar 2018 01:39:21 +0000 (18:39 -0700)]
kernel - Attempt to fix high vnlru cpu use

* In certain situations _cache_cleanpos() gets into a livelock
  of some sort.  It is limited by a counter but the livelock creates
  havoc when it happens.

* It appears that _cache_cleanpos() can get into a situation where
  the head element of all available nchashtbl[] slots is not freeable
  (e.g. due to having multiple refs).  When this occurs, trailing
  elements in the chained hash table cannot be recycled.

  nchashtbl[] is typically very large, so this situation does not
  happen very often.  There are usually plenty of entries to pick
  away at.  However, it looks like situations can develop where
  enough entries get into this masked state that the hysteresis is
  unable to complete, resulting in a cpubound loop.

* Refactor the chained list from LIST to TAILQ and modify the
  _cache_cleanpos() function to cycle ncp's to the end of the
  list before trying to zap them.  If the zap fails, the next
  iteration will encounter a different head.

Reported-by: ftigeot
16 hours agoatkbdc - Add additional ACPI PNP IDs specified by Microsoft for Keyboards.
Imre Vadász [Mon, 19 Mar 2018 22:39:17 +0000 (23:39 +0100)]
atkbdc - Add additional ACPI PNP IDs specified by Microsoft for Keyboards.

These IDs are from Microsofts device IDs list at
which is linked from http://www.uefi.org/PNP_ACPI_Registry.

This should fix some machines which failed to attach the PS2 Keyboard
after 131acb0380e93664f106117ebf8ba322a3d1b7c4, unless the acpi(4) module
was disabled.

20 hours agoperiodic - Adjust daily 160 and 161 (hammer and hammer2 cleanup)
Matthew Dillon [Mon, 19 Mar 2018 19:23:14 +0000 (12:23 -0700)]
periodic - Adjust daily 160 and 161 (hammer and hammer2 cleanup)

* Use /usr/bin/lockf to avoid backing up many hammer or hammer2
  cleanup processes, as a cleanup (depending on the situation
  and vfs.hammer2.bulkfree_tps setting) can take longer than a

33 hours agokernel - Implement QUICKHALT shortcut for unmounting during shutdown
Matthew Dillon [Mon, 19 Mar 2018 05:39:10 +0000 (22:39 -0700)]
kernel - Implement QUICKHALT shortcut for unmounting during shutdown

* Add the MNTK_QUICKHALT flag which allows the system to just unlink but
  otherwise ignore certain mount types during a halt or reboot.  For now
  we flag tmpfs, devfs, and procfs.

* The main impetus for this is to reduce the messing around we
  do with devfs during a shutdown.  Devfs has its fingers, and its
  vnodes, prettymuch sunk throughout the system (e.g. /dev/null, system
  console, vty's, root mount, and so on and so forth).  There's no
  real need to attempt to unwind all of that mess nicely.

34 hours agodevfs - Fix a few more issues (3)
Matthew Dillon [Mon, 19 Mar 2018 04:57:29 +0000 (21:57 -0700)]
devfs - Fix a few more issues (3)

* devfs_unlinkp() was improperly setting node->v_node to NULL,
  which messes up certain interlocks for race avoidance.

* Use vhold()/vdrop() instead of vref()/vrele() to prevent
  vnode destruction during node teardown.  The node can be
  torndown with an unreferenced vnode.  vref() will panic if
  the refcnt is not already > 0.

* Refactor devfs_vop_reclaim() a bit.  Do not interpose the
  v_release_rdev() call between the node check and the call
  to devfs_freep().

35 hours agokernel - Fix deadlock during halt/reboot
Matthew Dillon [Mon, 19 Mar 2018 04:12:14 +0000 (21:12 -0700)]
kernel - Fix deadlock during halt/reboot

* Fix a deadlock which occurs between udev and devfs.  udev
  must issue devfs_clone_bitmap_put() outside of the udev_lk.

* Fixes numerous shutdown/reboot deadlocks.

36 hours agodevfs - Fix a few more issues (2)
Matthew Dillon [Mon, 19 Mar 2018 02:57:19 +0000 (19:57 -0700)]
devfs - Fix a few more issues (2)

* The devfs_freep() issues were more extensive then originally
  determined.  There was another race, primarily due to some
  vnodes (related to unlinked devfs nodes) getting torn down
  before aliases during umount.

* Add another flag and adjust the code to not free the node
  structure until all link references (nlinks) have gone

* Also refactor locking and sequencing to further bullet-proof
  vnode reclaims vs devfs_freep()'s.

41 hours agopc64 - Improve TSC and LAPIC timer calibration code.
Imre Vadász [Sun, 25 Feb 2018 21:51:26 +0000 (22:51 +0100)]
pc64 - Improve TSC and LAPIC timer calibration code.

* The hw.tsc_calibrate_test=1 and hw.lapic_calibrate_test=1 tunables can
  be specified to test results of the calibration for different delays
  (from 100 milliseconds to 2 seconds in 100 millisecond steps).

* With this change the TSC and LAPIC calibration each should take only
  200 milliseconds, instead of the original 1 second and 2 second delays.

* This change tries to make the TSC calibration more exact, by averaging
  the TSC values from before and after reading the timer. By sampling the
  latency of reading the (HPET) timer, we can make sure that the start and
  end measurements of TSC and the (typically HPET or i8254) timer didn't
  get interrupted (e.g. by an SMI on hardware, or by the host when running
  virtualized), and filter out those outliers.

* Additionally for the TSC calibration the new code does 2 measurements at
  the start and end of the delay time, separated by 20 milliseconds. This
  should make results even more consistent.

* The hw.calibrate_tsc_fast=0 tunable can be set, to revert to the old TSC
  calibration code.

* Use the TSC to calibrate the LAPIC timer, when the TSC is invariant.
  Although this indirect calibration might accumulate inaccuracies, this
  still seems better. Since the TSC runs very fast, we can get a very
  accurate value in 200ms or even less.
  To forcibly disable the TSC based LAPIC calibration, set the
  hw.lapic_calibrate_fast=0 loader tunable.

* The fallback (without using the TSC) LAPIC calibration is slightly
  improved, by measuring the sysclock timestamp at the start and end of the
  measurement explicitly with sys_cputimer->count(). Also the lapic timer is
  explicitly read after starting the countdown.
  It also proves to be useful in at least some virtualization environments
  (e.g. QEMU with TCG emulation), to do some LAPIC timer access before
  actually measuring anything.

* The HPET and LAPIC mmio read accesses are no barrier for Intel and AMD
  cpus. So we explicitly have to avoid out-of-order execution of the rdtsc()
  call that follows the sys_cputimer->count(), by using rdtsc_ordered()
  which uses lfence or mfence on Intel and AMD CPUs respectively.

41 hours agoacpi_hpet - Implement early HPET initialization for TSC calibration.
Imre Vadász [Mon, 5 Feb 2018 21:55:23 +0000 (22:55 +0100)]
acpi_hpet - Implement early HPET initialization for TSC calibration.

41 hours agopc64 - Allow for initializing other cputimers than i8254 in early boot.
Imre Vadász [Sun, 18 Feb 2018 13:27:46 +0000 (14:27 +0100)]
pc64 - Allow for initializing other cputimers than i8254 in early boot.

41 hours agoA little mdoc cleanup in 3 manual pages.
Sascha Wildner [Sun, 18 Mar 2018 22:11:19 +0000 (23:11 +0100)]
A little mdoc cleanup in 3 manual pages.

44 hours agodm - synchronize disk info before returning
Matthew Dillon [Sun, 18 Mar 2018 19:26:17 +0000 (12:26 -0700)]
dm - synchronize disk info before returning

* DM now issues a disk_config(NULL) after setting up the disk info
  in order to wait for the probe to complete, otherwise callers
  may race trying to open() the disk device before it is actually

* Fixes cryptsetup luksOpen errors which occur due to probe races,
  typically when used in a VM or qemu.

Reported-by: Aaron LI
44 hours agoiwm - Improve firmware Time Event handling.
Imre Vadász [Sun, 18 Mar 2018 14:24:22 +0000 (15:24 +0100)]
iwm - Improve firmware Time Event handling.

* This is a mix of the OpenBSD Git 7fd9664469d1b717a307eebd74aeececbd3c41cc
  change, and syncing with the Linux iwlwifi code.

Taken-From: Linux iwlwifi, and OpenBSD

2 days ago<sys/mutex2.h>: Fix build without INVARIANTS.
Sascha Wildner [Sun, 18 Mar 2018 14:17:45 +0000 (15:17 +0100)]
<sys/mutex2.h>: Fix build without INVARIANTS.

Reported-by: ivadasz
2 days agoiwm - Avoid Tx watchdog timeout, when dropping a connection.
Imre Vadász [Sun, 18 Mar 2018 10:04:49 +0000 (11:04 +0100)]
iwm - Avoid Tx watchdog timeout, when dropping a connection.

2 days agoiwm - Track firmware state better, and improve handling in iwm_newstate().
Imre Vadász [Sat, 17 Mar 2018 14:48:02 +0000 (15:48 +0100)]
iwm - Track firmware state better, and improve handling in iwm_newstate().

* This avoids firmware resets in all the cases in iwm_newstate(). Instead
  iwm_bring_down_firmware() is called, which tears down all the STA
  connection state, according to the sc->sc_firmware_state value.

* Improve the behaviour of the LED blinking a bit, so it only blinks when
  there really is a wireless scan going on.

* Print the newstate arg in debug output of iwm_newstate(), to help in

This is inspired by the firmware state maintaining change in OpenBSD's iwm, by
stsp@openbsd.org (OpenBSD Git 0ddb056fb7370664b1d4b84392697cb17d1a414a).

2 days agosystat - Fix '?' suffix case for dirtybufspace reporting
Matthew Dillon [Sun, 18 Mar 2018 02:51:45 +0000 (19:51 -0700)]
systat - Fix '?' suffix case for dirtybufspace reporting

* Dirtybufspace (dirtyb) reporting sometimes showed a '?'
  because put64() didn't know how to upgrade 'k'.  Using 'K'
  solves the problem.

2 days agodevfs - Fix a few more issues
Matthew Dillon [Sun, 18 Mar 2018 02:43:01 +0000 (19:43 -0700)]
devfs - Fix a few more issues

* Fix a devfs_freep() race.  VOP_RECLAIM generated by unrelated
  system load (such as a 'du' which causes vnodes to recycle quickly)
  can race a node teardown because devfs_freep() temporarily unlocks
  devfs_lock across a vnode op.

* Instead of asserting, use the DEVFS_DESTROYED flag to check
  for the race.  The state will be stable for this particular race
  due to the vnode lock.

Reported-by: multiple
2 days agodevfs - Fix a few issues
Matthew Dillon [Sat, 17 Mar 2018 18:23:39 +0000 (11:23 -0700)]
devfs - Fix a few issues

* Report when an attempt is made to add a device node under a
  non-directory device node.

* devfs_freep() no longer asserts if the node is not linked.
  It's ok for the node to not be linked.  It still asserts on
  double calls to devfs_freep().

* Clean up nlinks during normal removals of nodes.

* Also iterate and remove orphan nodes on unmount.

* Misc syntax cleanups.

2 days agokernel - Fix udev devfs leak and possible panic
Matthew Dillon [Sat, 17 Mar 2018 18:11:26 +0000 (11:11 -0700)]
kernel - Fix udev devfs leak and possible panic

* udev was trying to add cloned nodes under /dev/udev, but /dev/udev
  is not a directory.

* Leave /dev/udev alone and put the cloned nodes under /dev/udevs/%d.

* Fixes 'X leaked device nodes' from devfs, particularly when mounted
  inside jails.

* Might also fix occassional devfs related panics.

2 days agohammer2 - Recover errornous lost flag (2)
Matthew Dillon [Sat, 17 Mar 2018 16:47:22 +0000 (09:47 -0700)]
hammer2 - Recover errornous lost flag (2)

* Also ensure the recovery pass is executed when remounting RW.

2 days agohammer2 - Recover errornous lost flag
Matthew Dillon [Sat, 17 Mar 2018 16:43:56 +0000 (09:43 -0700)]
hammer2 - Recover errornous lost flag

* Add a scan of the PFS root inodes which fixes any missing

2 days agoUpdate files for libpcap-1.8.1 import
Antonio Huete Jimenez [Sat, 17 Mar 2018 15:48:49 +0000 (08:48 -0700)]
Update files for libpcap-1.8.1 import

2 days agoMerge branch 'vendor/LIBPCAP'
Antonio Huete Jimenez [Sat, 17 Mar 2018 15:44:00 +0000 (08:44 -0700)]
Merge branch 'vendor/LIBPCAP'


3 days agoImport libpcap-1.8.1. vendor/LIBPCAP
Antonio Huete Jimenez [Sat, 17 Mar 2018 15:21:54 +0000 (08:21 -0700)]
Import libpcap-1.8.1.

See CHANGES for the details.

3 days agoefisetup - Use hammer2
Matthew Dillon [Sat, 17 Mar 2018 08:30:56 +0000 (01:30 -0700)]
efisetup - Use hammer2

* Adjust efisetup to use hammer2 instead of hammer1

3 days agokernel - Improve spinlock performance
Matthew Dillon [Sat, 17 Mar 2018 08:28:56 +0000 (01:28 -0700)]
kernel - Improve spinlock performance

* Primarily improve spinlock performance when transitioning
  from an exclusive to a shared lock by allowing atomic_fetchadd_int()
  to be used instead of atomic_cmpset_int().

* Also clean up a few remaining atomic_cmpset_int() cases that
  can use atomioc_fcmpset_int() instead.

Suggested-by: mjg
3 days agokernel - Clarify vsyncscan() operation
Matthew Dillon [Sat, 17 Mar 2018 08:27:39 +0000 (01:27 -0700)]
kernel - Clarify vsyncscan() operation

* Clarify vsyncscan() operation.

3 days agokernel - Fix rare race in mutex ownership transfer
Matthew Dillon [Sat, 17 Mar 2018 08:26:53 +0000 (01:26 -0700)]
kernel - Fix rare race in mutex ownership transfer

* Fix cases where competing mutexes can get confused over ownership,
  due to the mutex code not properly NULLing out the field in
  certain situations.

3 days agohammer - Fix bugs, fix serious snapshot bug, flush adjustments
Matthew Dillon [Sat, 17 Mar 2018 08:20:36 +0000 (01:20 -0700)]
hammer - Fix bugs, fix serious snapshot bug, flush adjustments

* Make sure we only flush the volume header for a general sync request
  and not for a fsync() on /.

* Fix more lock order reversals when translating directory entries
  to inodes.

* Separate out spmp elements into their own list to make umount ordering

* Flush in three stages.

  (1) flush dirty filesystem inodes
  (2) flush PFS meta-data topology up to the filesystem inodes.
  (3) flush the volume root and its meta-data up to the PFS inodes.

  This is staging for later sync concurrency improvements.

* Fix a bug where creating enough snapshots (more than 4 total PFSs)
  causes some PFSs to lose an important flag in their blockref, which
  causes flushes to stop working properly on that PFS.

3 days agohammer2 - More involved refactoring of chain_repparent, cleanup
Matthew Dillon [Fri, 16 Mar 2018 18:01:11 +0000 (11:01 -0700)]
hammer2 - More involved refactoring of chain_repparent, cleanup

* Remove unused locking flags (remove the NOLOCK and NOUNLOCK

* Add HAMMER2_RESOLVE_NONBLOCK to hammer2_chain_lock() for use
  only by hammer2_chain_getparent() and hammer2_chain_repparent().

* Refactor hammer2_chain_getparent() and hammer2_chain_repparent().
  Add a hot-path that uses HAMMER2_RESOLVE_NONBLOCK.  If this fails
  we now do a much more involved tracking operation via 'reptrack'
  to deal with races against indirect block deletions.

* Cleanup the copyright messages.

* Fix an issue where a sync could be held-up indefinitely by
  ongoing overlapping modifying operations.

* Install a proper initial inode count when creating a snapshot.

* Fix a deadlock in checkdirempty().  A chain lock was winding
  up being ordered incorrectly.

3 days agohammer2 - Refactor LRU chain recycling
Matthew Dillon [Wed, 14 Mar 2018 23:37:29 +0000 (16:37 -0700)]
hammer2 - Refactor LRU chain recycling

* Refactor LRU chain recycling by allowing a chain to remain on the
  LRU even if it gets referenced again.  This will be detected and
  handled properly if the LRU tries to recycle the chain.

* Improved LRU performance by avoiding unnecessary global-ish spinlocks.

* Also fixes a rare flagging/list race.

3 days agohammer2 - Flush asynchronization, bug fixes, stabilization (2)
Matthew Dillon [Wed, 14 Mar 2018 05:27:10 +0000 (22:27 -0700)]
hammer2 - Flush asynchronization, bug fixes, stabilization (2)

* Add the HAMMER2_INODE_DIRTYDATA flag and use it to interlock
  clearing the vnode's dirty flag.

3 days agohammer2 - Flush asynchronization, bug fixes, stabilization
Matthew Dillon [Wed, 14 Mar 2018 01:00:44 +0000 (18:00 -0700)]
hammer2 - Flush asynchronization, bug fixes, stabilization

* Better-asynchronize the flush (sync) code.  Generally split flushing
  of inodes and flushing of topology above the inodes such that we can
  flush the inodes inside a normal transaction.

  This leaves only the topology flush in the flush transaction (which
  locks out all other modifying transactions).  Concurrent read/write/
  flush performance is significantly improved.

* Fix numerous bugs in the inode tracking code where the chain topology
  under an inode could wind up remaining in a modified state when the
  vnode is in a clean state.  This could cause hefty 'sync' latency on
  clean trees (that had already been flushed).

* Fix numerous bugs in the handling of lost parent links, which occurs
  due to locking races primarily when indirect blocks have to be
  inserted or deleted.

* Deleted-chain sub-topology tracking had some issues which could lead
  to chain's being lost, resulting in malloc complaints on umount.

* Rename a few H2 sysctl variables for readability.

* Adjust the "dumpchain" debugging directive to allow us to trace
  the ONFLUSH topology.

3 days agoobjformat(1): Fix comment in the Makefile.
Sascha Wildner [Sat, 17 Mar 2018 08:30:45 +0000 (09:30 +0100)]
objformat(1): Fix comment in the Makefile.

3 days agolibipsec: Using snprintf() to append to a buffer is not valid in C99.
Sascha Wildner [Sat, 17 Mar 2018 07:40:02 +0000 (08:40 +0100)]
libipsec: Using snprintf() to append to a buffer is not valid in C99.

This silences a gcc80 -Wrestrict warning.

Reported-by: zrj
Taken-from:  FreeBSD (r216369)

3 days agokernel/usb4bsd: Sync the quirks with FreeBSD.
Sascha Wildner [Fri, 16 Mar 2018 18:44:40 +0000 (19:44 +0100)]
kernel/usb4bsd: Sync the quirks with FreeBSD.

Might be we don't yet properly support every device that some of
these quirks are for.

4 days agoUpdate the pciconf(8) database.
Sascha Wildner [Fri, 16 Mar 2018 06:42:33 +0000 (07:42 +0100)]
Update the pciconf(8) database.

March 6, 2018 snapshot from https://pci-ids.ucw.cz

5 days agodialog(1): Use ${} uniformly.
Sascha Wildner [Wed, 14 Mar 2018 16:42:51 +0000 (17:42 +0100)]
dialog(1): Use ${} uniformly.

6 days agoexport.5: Bump .Dd
Sascha Wildner [Wed, 14 Mar 2018 08:30:45 +0000 (09:30 +0100)]
export.5: Bump .Dd

6 days agomountd(8): Fix several more warnings, raise WARNS to 3
Aaron LI [Fri, 10 Nov 2017 12:44:40 +0000 (20:44 +0800)]
mountd(8): Fix several more warnings, raise WARNS to 3

6 days agoexports.5: network prefixlength (CIDR) format is supported
Aaron LI [Fri, 10 Nov 2017 12:04:33 +0000 (20:04 +0800)]
exports.5: network prefixlength (CIDR) format is supported

Also take various minor fixes from FreeBSD.

6 days agomountd(8): Fix a type mismatch and several compilation warnings
Aaron LI [Fri, 10 Nov 2017 12:03:25 +0000 (20:03 +0800)]
mountd(8): Fix a type mismatch and several compilation warnings

The char ** type mismatch is taken from FreeBSD r292864

6 days agomountd(8): Replace malloc+strcpy with strdup/strndup
Aaron LI [Fri, 10 Nov 2017 12:01:35 +0000 (20:01 +0800)]
mountd(8): Replace malloc+strcpy with strdup/strndup

Taken-from: FreeBSD r324007,r324014

6 days agomountd(8): Change default uid/gid to nobody/nogroup (65534/65533)
Aaron LI [Fri, 10 Nov 2017 11:38:10 +0000 (19:38 +0800)]
mountd(8): Change default uid/gid to nobody/nogroup (65534/65533)

The default values found in /etc/passwd and /etc/group are 65534, 65533.
In mountd.c, the defaults were -2, which was 65534 back when uid_t was 16bits.
Without this patch, a file created by root on an NFS exported volume without
the "-root=" export option will end up owned by uid 4**32 - 2.
When discussed on freebsd-current@, it seemed that users preferred the
values being changed to 65534/65533.
I have not added code to acquire these values from the databases, since
the mountd daemon might get "stuck" during startup waiting for a non-responsive
password database server.

Taken-from: FreeBSD usr.sbin/mountd/mountd.c r318262

6 days agomountd(8): Fix conversion of prefix length to a netmask
Aaron LI [Fri, 10 Nov 2017 11:02:16 +0000 (19:02 +0800)]
mountd(8): Fix conversion of prefix length to a netmask

Taken-from: FreeBSD usr.sbin/mountd/mountd.c r219125

6 days agotest - Fix fsx build
Matthew Dillon [Wed, 14 Mar 2018 00:56:32 +0000 (17:56 -0700)]
test - Fix fsx build

* Fix the 'install' target so it works as intended.

7 days agoAdd references to mount_hammer2.8 in a few manual pages.
Sascha Wildner [Tue, 13 Mar 2018 10:40:26 +0000 (11:40 +0100)]
Add references to mount_hammer2.8 in a few manual pages.

7 days agops.1: Update FILES section a bit.
Sascha Wildner [Tue, 13 Mar 2018 10:37:43 +0000 (11:37 +0100)]
ps.1: Update FILES section a bit.

7 days agomtree: Remove BSD.local.dist.
Sascha Wildner [Tue, 13 Mar 2018 10:30:01 +0000 (11:30 +0100)]
mtree: Remove BSD.local.dist.

The (d)ports framework uses its own Templates/BSD.local.dist.

Discussed-with: zrj

7 days agoetc/periodic: Add more xz(1)/zstd(1) support.
Sascha Wildner [Tue, 13 Mar 2018 10:01:43 +0000 (11:01 +0100)]
etc/periodic: Add more xz(1)/zstd(1) support.

7 days agoperiodic/security/800.loginfail: Add xz(1) and zstd(1) support.
Sascha Wildner [Tue, 13 Mar 2018 09:49:10 +0000 (10:49 +0100)]
periodic/security/800.loginfail: Add xz(1) and zstd(1) support.

7 days agoperiodic.conf.5: Document two more variables.
Sascha Wildner [Tue, 13 Mar 2018 09:21:59 +0000 (10:21 +0100)]
periodic.conf.5: Document two more variables.

7 days agokernel - Remove minidump debugging
Matthew Dillon [Tue, 13 Mar 2018 02:09:59 +0000 (19:09 -0700)]
kernel - Remove minidump debugging

* Remove minidump debugging "pdp %04x..." lines.  Minidump fixes have
  been well tested at this point.

8 days agoperiodic: Sync with FreeBSD current
Aaron LI [Thu, 8 Mar 2018 16:28:24 +0000 (00:28 +0800)]
periodic: Sync with FreeBSD current

* Sync periodic scripts, periodic.conf, periodic.conf.5 with FreeBSD
* The "{daily,weekly,monthly}_status_security_<var>_enable" variables are
  changed to be "security_status_<var>_enable" and
  "security_status_<var>_period" (daily, weekly, monthly).
* Keep DFly-specific settings (e.g., HAMMER and HAMMER2 related)
* Ignore the FreeBSD-specific things, e.g., ZFS, GEOM

8 days agorc.d/accounting: Sync with FreeBSD
Aaron LI [Thu, 8 Mar 2018 16:26:34 +0000 (00:26 +0800)]
rc.d/accounting: Sync with FreeBSD

Prepare to sync periodic with FreeBSD

8 days agoperiodic: Remove obsolete daily/status-named and weekly/clean-kvmdb
Aaron LI [Thu, 8 Mar 2018 16:24:33 +0000 (00:24 +0800)]
periodic: Remove obsolete daily/status-named and weekly/clean-kvmdb

8 days agoperiodic: Remove already disabled monthly statistics report
Aaron LI [Thu, 8 Mar 2018 16:14:47 +0000 (00:14 +0800)]
periodic: Remove already disabled monthly statistics report

The up-to-date tool can be obtained from DPorts: sysutils/bsdstats

To sync with FreeBSD

8 days agoperiodic(8): Sync with FreeBSD current
Aaron LI [Thu, 8 Mar 2018 03:10:19 +0000 (11:10 +0800)]
periodic(8): Sync with FreeBSD current

8 days agocryptsetup(8): Revert part of 0482a033108. We got mlockall().
Sascha Wildner [Mon, 12 Mar 2018 07:53:20 +0000 (08:53 +0100)]
cryptsetup(8): Revert part of 0482a033108. We got mlockall().

8 days agoinitrd/oinit: chdir to the new root before chroot to it
Aaron LI [Mon, 12 Mar 2018 04:10:39 +0000 (12:10 +0800)]
initrd/oinit: chdir to the new root before chroot to it

chroot(2) doesn't change the working directory of the current process,
therefore a single chroot(2) to a new root (during the early boot with
encrypted root) causes getcwd(3) fail, which further causes problems for
some rc scripts.

For example:
Without this fix, and by placing a 'echo "PWD=`pwd`"' to the beginning
of /etc/rc, the following messages were logged on the console:
Mar 12 10:40:28 dfly kernel: pwd: .: No such file or directory
Mar 12 10:40:28 dfly kernel: PWD=

Another example with "unbound" rc start:
Mar  3 09:28:11 dfly kernel: Obtaining a trust anchor:
Mar  3 09:28:11 dfly kernel: _su: No such file or directory
Mar  3 09:28:11 dfly kernel: _su: Trying to start from "/"
Mar  3 09:28:12 dfly kernel: .
Mar  3 09:28:12 dfly kernel: [1520040492] unbound-checkconf[1138:0] error: cannot getcwd: No such file or directory
Mar  3 09:28:12 dfly kernel: Starting unbound.
Mar  3 09:28:12 dfly kernel: [1520040492] unbound[1139:0] warning: unbound is already running as pid 1139.

uWSGI rc startup also failed to setup correct working directory due to
this problem.

8 days agoImport byacc-20170709
Antonio Huete Jimenez [Sun, 11 Mar 2018 15:17:21 +0000 (08:17 -0700)]
Import byacc-20170709

9 days agodisklabel64 - Make disktype optional, fix alignment bug
Matthew Dillon [Sat, 10 Mar 2018 21:39:59 +0000 (13:39 -0800)]
disklabel64 - Make disktype optional, fix alignment bug

* Make the disktype optional, use 'auto' automatically

* Fix a bug in the kernel's l64_makevirginlabel() calculation.
  It was not properly calculating the alignment relative to
  the physical disk.

* Refactor some of the documentation

* Refactor examples

Submitted-by: Aaron LI <aly@aaronly.me>
9 days agoboot/efi: Sync our TianoCore EDK II headers with the UDK2018 branch.
Sascha Wildner [Sat, 10 Mar 2018 19:34:23 +0000 (20:34 +0100)]
boot/efi: Sync our TianoCore EDK II headers with the UDK2018 branch.

Just comments in one header.

10 days agolocate(1): Bring in some updates/fixes from FreeBSD
Aaron LI [Sat, 10 Mar 2018 03:59:29 +0000 (11:59 +0800)]
locate(1): Bring in some updates/fixes from FreeBSD

* The default value of "FILESYSTEMS" option is now determined using lsvfs(1),
  which contains all local file systems that are not synthetic, loopback mounts
  or read-only.
* New config option "PRUNEDIRS" in /etc/locate.rc with default value of ".git"
  to ignore the ".git" directories when making database.
* Warn when locate.updatedb(8) is directly run by root
* Some cleanups (no functional change)
* Improve license declarations, fix white spaces and typos

10 days agolsvfs(1): Return simply 1 on failure.
Sascha Wildner [Sat, 10 Mar 2018 09:17:41 +0000 (10:17 +0100)]
lsvfs(1): Return simply 1 on failure.

10 days agolsvfs(1): Tabify the rest of lsvfs.c.
Sascha Wildner [Sat, 10 Mar 2018 09:17:00 +0000 (10:17 +0100)]
lsvfs(1): Tabify the rest of lsvfs.c.

10 days agolsvfs(1): Sync a bit with FreeBSD, as applicable.
Sascha Wildner [Sat, 10 Mar 2018 09:08:27 +0000 (10:08 +0100)]
lsvfs(1): Sync a bit with FreeBSD, as applicable.

Specifically, merge r185029/r251580 and sync the manual page.

Taken-from: FreeBSD

10 days agolsvfs.1: Explain why lsvfs(1) shows 2 references to UFS on encrypted root.
Sascha Wildner [Sat, 10 Mar 2018 08:16:00 +0000 (09:16 +0100)]
lsvfs.1: Explain why lsvfs(1) shows 2 references to UFS on encrypted root.

While here, fix two cases where a new sentence didn't start on a new

Idea-by: Aaron LI <aly@aaronly.me>
10 days agonvmectl(8): Add missing DPADD in the Makefile.
Sascha Wildner [Fri, 9 Mar 2018 18:30:58 +0000 (19:30 +0100)]
nvmectl(8): Add missing DPADD in the Makefile.

11 days agolocate.updatedb(8): Add hammer2 support.
Sascha Wildner [Fri, 9 Mar 2018 08:26:53 +0000 (09:26 +0100)]
locate.updatedb(8): Add hammer2 support.

Reported-by: Aaron LI <aly@aaronly.me>
13 days agodes_crypt.3: Fix typo.
Sascha Wildner [Wed, 7 Mar 2018 09:15:19 +0000 (10:15 +0100)]
des_crypt.3: Fix typo.

13 days agopsm.4: Remove useless BUGS section.
Sascha Wildner [Wed, 7 Mar 2018 09:08:12 +0000 (10:08 +0100)]
psm.4: Remove useless BUGS section.

13 days agosysmouse.4: Fix some typos.
Sascha Wildner [Wed, 7 Mar 2018 09:03:59 +0000 (10:03 +0100)]
sysmouse.4: Fix some typos.

13 days agosys/vfs/autofs: Cleanups
Tomohiro Kusumi [Tue, 6 Mar 2018 18:27:04 +0000 (03:27 +0900)]
sys/vfs/autofs: Cleanups

Move local varaibles to inner scopes where possible.
The existing local variable declarations are mostly from FreeBSD,
but I've also changed NetBSD autofs the way this commit does.

(Don't do this for autofs userspace though. Increasing diff from
FreeBSD for non functional thing like this is much less important,
whereas kernel side is basically a rewrite.)

2 weeks agokernel/extp{read,write}v: Change ioccnt from u_int to int.
Sascha Wildner [Tue, 6 Mar 2018 07:46:34 +0000 (08:46 +0100)]
kernel/extp{read,write}v: Change ioccnt from u_int to int.

Just like preadv(), pwritev(). Struct uio's uio_ioccnt is also int.
Also adjust iovec_copyin() to take an int.

While here, make iovec const, also like in preadv/pwritev.

Discussed-with: dillon

2 weeks agosyscons: Remove unused variable.
zrj [Mon, 5 Mar 2018 07:21:33 +0000 (09:21 +0200)]
syscons: Remove unused variable.

2 weeks agosyscons - Fix NULL pointer access in 0d7c8a4d1cafae68239
Imre Vadász [Sun, 4 Mar 2018 21:49:59 +0000 (22:49 +0100)]
syscons - Fix NULL pointer access in 0d7c8a4d1cafae68239

2 weeks agoflopen.3: Use .Fa where appropriate.
Sascha Wildner [Sun, 4 Mar 2018 16:42:13 +0000 (17:42 +0100)]
flopen.3: Use .Fa where appropriate.

2 weeks agosyscons - Wait for drm modesetting at appropriate places.
Imre Vadász [Sun, 4 Mar 2018 13:51:34 +0000 (14:51 +0100)]
syscons - Wait for drm modesetting at appropriate places.

* This avoids races between userland using DRM, and the drm modesetting
  callbacks called by syscons.

* Always call the drm modesetting callback, when we are switching from a
  virtual terminal that is in Graphics mode. Before that was skipped unless
  we were switching to a virtual terminal that is in Text mode.
  However with the framebuffer mmap-ing through syscons, it also makes sense
  to use virtual terminals in Graphics mode, without going through drm. So
  we have to make sure to restore the syscons framebuffer there as well.

2 weeks agopc64 - Unmask some AMD Family 15h and 16h CPUs for TSC mpsync test.
Imre Vadász [Sun, 4 Mar 2018 12:03:57 +0000 (13:03 +0100)]
pc64 - Unmask some AMD Family 15h and 16h CPUs for TSC mpsync test.

* The problematic
  Erratum 778 "Processor Core Time Stamp Counters May Experience Drift" is
  only listed for Family 15h < Model 30h and for Family 16h < Model 30h
  (Family 15h == Bulldozer, and Family 16h == Jaguar).

2 weeks agoFix typo in MLINK name.
Sascha Wildner [Sun, 4 Mar 2018 09:18:24 +0000 (10:18 +0100)]
Fix typo in MLINK name.

2 weeks agoRemove some sendsys()/waitsys() remains.
Sascha Wildner [Sat, 3 Mar 2018 17:20:16 +0000 (18:20 +0100)]
Remove some sendsys()/waitsys() remains.

2 weeks agosysmouse - Fix sigio handling after c2962d9da8200947ee394b190eea39d437fb1af7
Imre Vadász [Wed, 28 Feb 2018 20:47:08 +0000 (21:47 +0100)]
sysmouse - Fix sigio handling after c2962d9da8200947ee394b190eea39d437fb1af7

2 weeks agoRemove some really old portability hacks that should no longer be needed.
Sascha Wildner [Sat, 3 Mar 2018 15:52:10 +0000 (16:52 +0100)]
Remove some really old portability hacks that should no longer be needed.

This no longer declares ftruncate()/lseek()/mmap() and truncate() in
either <stdio.h> or <sys/types.h>. 20 years after FreeBSD added it
(in r24896) we should be over it. What's left, we'll fix better.

2 weeks ago<arpa/inet.h>: Some cleanups.
Sascha Wildner [Sat, 3 Mar 2018 15:42:06 +0000 (16:42 +0100)]
<arpa/inet.h>: Some cleanups.

* Stop defining struct in6_addr. This doesn't belong here, and it was
  originally only added because of some issue in pkgsrc. Thanks to
  Sevan Janiyan for confirming that this no longer occurs.

* Incude <stdint.h> instead of the full <sys/types.h> and define
  in_addr_t and in_port_t per POSIX.

* Put inet_ntoa_r under __BSD_VISIBLE.

* Remove an obsolete comment.

2 weeks ago<pthread.h>: Add missing 'const' to four functions.
Sascha Wildner [Sat, 3 Mar 2018 15:34:48 +0000 (16:34 +0100)]
<pthread.h>: Add missing 'const' to four functions.

2 weeks agoSort SEE ALSO in two manual pages.
Sascha Wildner [Fri, 2 Mar 2018 13:30:48 +0000 (14:30 +0100)]
Sort SEE ALSO in two manual pages.

2 weeks agonfs.5: Add missing markup.
Sascha Wildner [Fri, 2 Mar 2018 07:10:50 +0000 (08:10 +0100)]
nfs.5: Add missing markup.

2 weeks agonfs.5: Clarify vfs.nfs.nfsv3_commit_on_close description a bit.
Sascha Wildner [Fri, 2 Mar 2018 07:08:07 +0000 (08:08 +0100)]
nfs.5: Clarify vfs.nfs.nfsv3_commit_on_close description a bit.

2 weeks ago{read,write}.2: A bit more cleanup. Also add ext*() MLINKS.
Sascha Wildner [Fri, 2 Mar 2018 06:40:17 +0000 (07:40 +0100)]
{read,write}.2: A bit more cleanup. Also add ext*() MLINKS.

2 weeks agoworld - Document extpread() and extpwrite()
Matthew Dillon [Fri, 2 Mar 2018 02:57:11 +0000 (18:57 -0800)]
world - Document extpread() and extpwrite()

* Document these DragonFly-specific system calls.

2 weeks agofstat(1): Add hammer2 support.
Sascha Wildner [Wed, 28 Feb 2018 13:24:07 +0000 (14:24 +0100)]
fstat(1): Add hammer2 support.

2 weeks ago<vfs/hammer2/hammer2.h>: Expose VTOI() with _KERNEL_STRUCTURES.
Sascha Wildner [Wed, 28 Feb 2018 13:22:56 +0000 (14:22 +0100)]
<vfs/hammer2/hammer2.h>: Expose VTOI() with _KERNEL_STRUCTURES.

3 weeks agokernel/netgraph7: Fix panic
Markus Pfeiffer [Sat, 24 Feb 2018 14:11:06 +0000 (14:11 +0000)]
kernel/netgraph7: Fix panic

We just unset the M_HASH flag for the mbuf before queueing the
message to the netisr, making sure the handler doesn't run
on the wrong CPU.

3 weeks agolibc: Fix a comment in Makefile.inc.
Sascha Wildner [Fri, 23 Feb 2018 08:30:55 +0000 (09:30 +0100)]
libc: Fix a comment in Makefile.inc.

3 weeks agostring.3: Fix types of strlcat() and strlcpy() prototypes.
Sascha Wildner [Fri, 23 Feb 2018 07:57:14 +0000 (08:57 +0100)]
string.3: Fix types of strlcat() and strlcpy() prototypes.

3 weeks agosyscons - Detangle sysmouse from tty handling, implement a custom FIFO.
Imre Vadász [Thu, 22 Feb 2018 21:54:33 +0000 (22:54 +0100)]
syscons - Detangle sysmouse from tty handling, implement a custom FIFO.

* This avoids unnecessary IPIs and other overhead from the tty handling.

* This also makes reads from the character device always get only complete
  sysmouse packets.