Import a new version of NetBSD's mtree.

This version of mtree implements a new flag (-O) that can be used to
restrict the tool to certain pathnames. Also, it fixes a compiler
warning generated by -Wmissing-variable-declarations.

Acked by:	brooks


git-svn-id: svn://svn.freebsd.org/base/head@249293 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Use IP6STAT_INC/IP6STAT_DEC macros to update ip6 stats.

MFC after:	1 week


git-svn-id: svn://svn.freebsd.org/base/head@249294 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix VIMAGE build.


git-svn-id: svn://svn.freebsd.org/base/head@249302 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix the assertions for the state of the object under the map entry
with the MAP_ENTRY_VN_WRITECNT flag:
- Move the assertion that verifies the state of the v_writecount and
  vnp.writecount, under the block where the object is locked.
- Check that the object type is OBJT_VNODE before asserting.

Reported by:	avg
Reviewed by:	alc
MFC after:	1 week


git-svn-id: svn://svn.freebsd.org/base/head@249303 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix build for AIM 64bit.


git-svn-id: svn://svn.freebsd.org/base/head@249304 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix KASSERTs: maximum number of items per slab is 256.


git-svn-id: svn://svn.freebsd.org/base/head@249305 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revert local changes and pull in r3828 from upstream.


git-svn-id: svn://svn.freebsd.org/base/head@249307 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Last remaining prototype issue that still hasn't been fixed upstream.


git-svn-id: svn://svn.freebsd.org/base/head@249308 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Since now we support 256 items per slab, we need more bits
for us_freecount.

This grows uma_slab_head on 32-bit arches, but growth isn't
significant. Taking kmem zones as example, only the 32 byte
zone is affected, ipers is reduced from 113 to 112.

In collaboration with:	kib


git-svn-id: svn://svn.freebsd.org/base/head@249309 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add static/const keywords to the arrays.

This theoretically allows a compiler to optimize (parts of) the array
away if unused.

While there, make the array size implicit and use a _Static_assert() to
ensure that the definition matches up with the number of elements in the
list.


git-svn-id: svn://svn.freebsd.org/base/head@249311 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Swap us_freecount and us_flags, achieving same structure size
as before previous commit.

Submitted by:	alc


git-svn-id: svn://svn.freebsd.org/base/head@249312 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Convert UMA code to C99 uintXX_t types.


git-svn-id: svn://svn.freebsd.org/base/head@249313 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Pass the segmented address of the counter, based on %fs, i.e. offset
from the pcpu[0] to the counter base, instead of the linear address.


git-svn-id: svn://svn.freebsd.org/base/head@249314 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Proxy allocation requests for the PCI ROM BAR from child devices similar
to how the VGA bus driver currently proxies allocation requests for other
PCI BARs.

MFC after:	1 week


git-svn-id: svn://svn.freebsd.org/base/head@249315 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Ensure make -j N universe works correctly, by checking for an up-to-date
make before starting the universe targets themselves.  Otherwise, all of
the targets would attempt to build make simultaneously, overwriting each
other's copies of the make object files and executable.  This could lead
to strange errors, for example when partially-written make executables
are invoked.

Also amend r216620, to make the rest of universe wait properly until the
upgrade_checks target is finished, by adding universe_${target}_prologue
to the .ORDER target.  Otherwise, make will be too smart for its own
good, and start building the universe targets simultaneously with the
prologues anyway.

MFC after:	1 week


git-svn-id: svn://svn.freebsd.org/base/head@249316 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix a race condition on tcp listen socket teardown with pending
connections in the accept queue and contiguous new incoming SYNs.

Compared to the original submitters patch I've moved the test
next to the SYN handling to have it together in a logical unit
and reworded the comment explaining the issue.

Submitted by:	Matt Miller <matt@matthewjmiller.net>
Submitted by:	Juan Mojica <jmojica@gmail.com>
Reviewed by:	Matt Miller (changes)
Tested by:	pho
MFC after:	1 week


git-svn-id: svn://svn.freebsd.org/base/head@249317 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Change certain heavily used network related mutexes and rwlocks to
reside on their own cache line to prevent false sharing with other
nearby structures, especially for those in the .bss segment.

NB: Those mutexes and rwlocks with variables next to them that get
changed on every invocation do not benefit from their own cache line.
Actually it may be net negative because two cache misses would be
incurred in those cases.


git-svn-id: svn://svn.freebsd.org/base/head@249318 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
ZFS expects a copyout of zfs_cmd_t on an ioctl error. Our sys_ioctl()
doesn't copyout in this case.

To solve this issue a new struct zfs_iocparm_t is introduced consisting of:
- zfs_ioctl_version (future backwards compatibility purposes)
- user space pointer to zfs_cmd_t (copyin and copyout)
- size of zfs_cmd_t (verification purposes)

The copyin and copyout of zfs_cmd_t is now done the illumos (vendor) way
what makes porting of new changes easier and ensures correct behavior if
returning an error.

MFC after:	10 days


git-svn-id: svn://svn.freebsd.org/base/head@249319 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix the build.


git-svn-id: svn://svn.freebsd.org/base/head@249320 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Improve PCI BAR emulation:
- Respect the MEMEN and PORTEN bits in the command register
- Allow the guest to reprogram the address decoded by the BAR

Submitted by:	Gopakumar T
Obtained from:	NetApp


git-svn-id: svn://svn.freebsd.org/base/head@249321 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f