Avoid memory accesses reordering which can result in fget_unlocked()
seeing a stale fd_ofiles table once fd_nfiles is already updated,
resulting in OOB accesses.

Approved by:	re (kib)
Sponsored by:	EMC / Isilon storage division
Reported and tested by:	pho
Reviewed by:	benno
Add PCI device ID for MegaRAID Invader cards.  This was the only
change needed to make it work on my card.

Approved by:	re (glebius)
Re-do r255853.  Along with adding back the API/ABI changes from the
original, this hides the contents of cam_compat.h from ktrace/kdump/truss,
avoiding problems there.  There are no user-servicable parts in there, so
no need for those tools to be groping around in there.

Approved by:	re
Re-do r255853.  Along with adding back the API/ABI changes from the
original, this hides the contents of cam_compat.h from ktrace/kdump/truss,
avoiding problems there.  There are no user-servicable parts in there, so
no need for those tools to be groping around in there.

Approved by:    re
Additional BIND files.

Submitted by:	bdrewery
Approved by:	re (blanket)
Correct a NULL pointer deference in nslookup and nsupdate that would
cause the utility to crash in interactive mode when the user gives
an EOF on standard input.

MFC after:	3 days
Approved by:	re (gjb)
Add an elf note on ARM to store the MACHINE_ARCH an executable was built
for. This is useful for software needing to know which architecture a
binary is built for as arm and armv6 have slight differences meaning only
some binaries build for one will work as expected on the other. It is
expected pkgng will be able to make use of this to simplify the logic to
determine which package ABI to use.

Approved by:	re (kib)
Make the callout arithmetic more robust adding checks for overflow.
Without these, if the timeout value passed is "large enough", the
value of the sum of it and other factors (e.g. current time as
returned by sbinuptime() or 'precision' argument) might result in a
negative number. This negative number is then passed to
eventtimers(4), which causes et_start() routine to load et_min_period
into eventtimer, making the CPU where the thread is stuck forever in
timer interrupt handler routine. This is now avoided rounding to
INT64_MAX the timeout period in case of overflow.

Reported by:	kib, pho
Discussed with:	kib, mav
Tested by:	pho (stress2 suite, kevent7.sh scenario)
Approved by:	re (kib)
Now that the portsnap buildbox is generating the raw bits for INDEX-10,
add it to the set of INDEX files built by portsnap.

Approved by:	re (marius), portmgr (erwin)
MFC after:	3 days
Acquire a hold reference on the vnode when a knote is instantiated.
Otherwise, knote keeps a pointer to a vnode which could become invalid
any time.

Reported by:	many
Tested by:	Patrick Lamaiziere <patfbsd@davenulle.org>
Discussed with:	jmg
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Approved by:	re (marius)
Do not allow negative timeouts for kqueue timers, check for the
negative timeout both before and after the conversion to sbintime_t.

For periodic kqueue timer, convert zero timeout into 1ms, to avoid
interrupt storm on fast event timers.

Reported and tested by:	pho
Discussed with:	mav
Reviewed by:	davide
Sponsored by:	The FreeBSD Foundation
Approved by:	re (marius)
Eliminate the declaration for a method that is no longer used.  (This
change should have been a part of r255724.)

Reminded by:	nathan
Approved by:	re (gjb)
Fix incorrect assertion on the minimum side. ZFS would
trigger this.

Reported by:	Chris Torek, Allan Jude
Approved by:	re@ (blanket)
Import NetBSD readline.c,v 1.104: do not crash with add_history(NULL).

MFC after:	3 days
Approved by:	re (gjb)
it must be the last member, not might...

Reviewed by:	attilio
Approved by:	re (delphij, gjb)
Temporarily disable iconv for non-shared library builds.  The dynamic
loading of conversation table is not yet compatible with static builds.

Approved by:	re (gjb)
Improve bsdpatch usability:

 - Ask only once for "Apply anyway". [1]
 - Tell user what file have failed patch rather than just how
   many hunks failed.

Reported by:	jmg via pfg [1]
Tested by:	pfg [1]
Approved by:	re (gjb)
Fix bug where UART unit number was not set properly, which prevented
operation on systems with multiple serial ports. Also turn on
interrupts for the UART device, which were disabled due to a
now-fixed bug in QEMU.

Approved by:	re (gjb)
As idling the CPU no longer causes hangs on QEMU, reenable the pSeries
cpu_idle() routine.

Approved by:	re (delphij)
Allow Open Firmware syscons to attach to devices without an "address"
property such as those found on some real and emulated IBM systems. The
approach, which is taken from Linux, is to scan through the PCI bars
until we find one large enough to contain the linear framebuffer and
which is ideally prefetchable if no "address" property can be found.
This makes the graphical console work with the pSeries target in QEMU.

Approved by:	re (delphij)